From 856bdfb0585cea3c67eedfb535c6477d51e4c352 Mon Sep 17 00:00:00 2001 From: Philipp Hofer Date: Thu, 12 Nov 2020 13:04:38 +0100 Subject: tdf#123936 Formatting files in module jvmfwk with clang-format Change-Id: Ie643402fbf10ac837c975d29068b7973e9dd6210 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105685 Tested-by: Jenkins Reviewed-by: Christian Lohmaier --- jvmfwk/inc/elements.hxx | 69 ++++++++++++------------ jvmfwk/inc/fwkbase.hxx | 13 ++--- jvmfwk/inc/libxmlutil.hxx | 40 +++++++------- jvmfwk/inc/vendorbase.hxx | 40 ++++++-------- jvmfwk/plugins/sunmajor/pluginlib/gnujre.hxx | 13 ++--- jvmfwk/plugins/sunmajor/pluginlib/otherjre.hxx | 8 ++- jvmfwk/plugins/sunmajor/pluginlib/sunjre.hxx | 8 ++- jvmfwk/plugins/sunmajor/pluginlib/sunversion.hxx | 21 ++++---- jvmfwk/plugins/sunmajor/pluginlib/util_cocoa.hxx | 2 +- 9 files changed, 98 insertions(+), 116 deletions(-) (limited to 'jvmfwk') diff --git a/jvmfwk/inc/elements.hxx b/jvmfwk/inc/elements.hxx index 58ad6044f300..3fde096c44a4 100644 --- a/jvmfwk/inc/elements.hxx +++ b/jvmfwk/inc/elements.hxx @@ -36,7 +36,6 @@ struct JavaInfo; namespace jfw { - /** gets the value of the updated element from the javavendors.xml. */ OString getElementUpdated(); @@ -47,9 +46,7 @@ OString getElementUpdated(); [out]If true then the respective structure of elements was added and the document needs to be saved. */ -void createSettingsStructure( - xmlDoc * document, bool * bNeedsSave); - +void createSettingsStructure(xmlDoc* document, bool* bNeedsSave); /** represents the settings saved in the /java/javaInfo element. It is used within class NodeJava which determines the settings @@ -91,12 +88,12 @@ public: If javaInfo@xsi:nil = true then member bNil is set to true and no further elements are read. */ - void loadFromNode(xmlDoc * pDoc,xmlNode * pJavaInfo); + void loadFromNode(xmlDoc* pDoc, xmlNode* pJavaInfo); /** The attribute nil will be set to false. The function gets the value javaSettings/updated from the javavendors.xml and writes it to javaInfo@vendorUpdate in javasettings.xml */ - void writeToNode(xmlDoc * pDoc, xmlNode * pJavaInfo) const; + void writeToNode(xmlDoc* pDoc, xmlNode* pJavaInfo) const; /** returns NULL if javaInfo is nil. */ @@ -116,9 +113,13 @@ public: class NodeJava { public: - enum Layer { USER, SHARED }; -private: + enum Layer + { + USER, + SHARED + }; +private: /** creates settings file and fills it with default values. When this function is called then it creates the @@ -147,7 +148,7 @@ private: /** Verifies if the respective settings file exist. */ - static jfw::FileStatus checkSettingsFileStatus(OUString const & sURL); + static jfw::FileStatus checkSettingsFileStatus(OUString const& sURL); /** Determines the layer for which the instance the loads and writes the data. @@ -164,7 +165,7 @@ private: If /java/userClassPath@xsi:nil == true then the value is uninitialized after a call to load(). */ - std::optional< OUString> m_userClassPath; + std::optional m_userClassPath; /** User configurable option. /java/javaInfo If /java/javaInfo@xsi:nil == true then the value is uninitialized after a call to load. @@ -174,15 +175,14 @@ private: If /java/vmParameters@xsi:nil == true then the value is uninitialized after a call to load. */ - std::optional< ::std::vector< OUString> > m_vmParameters; + std::optional<::std::vector> m_vmParameters; /** User configurable option. /java/jreLocations If /java/jreLocations@xsi:nil == true then the value is uninitialized after a call to load. */ - std::optional< ::std::vector< OUString> > m_JRELocations; + std::optional<::std::vector> m_JRELocations; public: - explicit NodeJava(Layer theLayer); /** sets m_enabled. @@ -192,14 +192,14 @@ public: /** sets m_sUserClassPath. See setEnabled. */ - void setUserClassPath(const OUString & sClassPath); + void setUserClassPath(const OUString& sClassPath); /** sets m_aInfo. See setEnabled. @param bAutoSelect true- called by jfw_setSelectedJRE false called by jfw_findAndSelectJRE */ - void setJavaInfo(const JavaInfo * pInfo, bool bAutoSelect); + void setJavaInfo(const JavaInfo* pInfo, bool bAutoSelect); /** sets the /java/vmParameters/param elements. When this method all previous values are removed and replaced @@ -207,12 +207,12 @@ public: /java/vmParameters@xsi:nil will be set to true when write() is called. */ - void setVmParameters(std::vector const & arParameters); + void setVmParameters(std::vector const& arParameters); /** adds a location to the already existing locations. Note: call load() before, then add the location and then call write(). */ - void addJRELocation(OUString const & sLocation); + void addJRELocation(OUString const& sLocation); /** writes the data to user settings. */ @@ -224,22 +224,22 @@ public: /** returns the value of the element /java/enabled */ - const std::optional & getEnabled() const { return m_enabled;} + const std::optional& getEnabled() const { return m_enabled; } /** returns the value of the element /java/userClassPath. */ - const std::optional< OUString> & getUserClassPath() const { return m_userClassPath;} + const std::optional& getUserClassPath() const { return m_userClassPath; } /** returns the value of the element /java/javaInfo. */ - const std::optional & getJavaInfo() const { return m_javaInfo;} + const std::optional& getJavaInfo() const { return m_javaInfo; } /** returns the parameters from the element /java/vmParameters/param. */ - const std::optional< ::std::vector< OUString> > & getVmParameters() const { return m_vmParameters;} + const std::optional<::std::vector>& getVmParameters() const { return m_vmParameters; } /** returns the parameters from the element /java/jreLocations/location. */ - const std::optional< ::std::vector< OUString> > & getJRELocations() const { return m_JRELocations;} + const std::optional<::std::vector>& getJRELocations() const { return m_JRELocations; } }; /** merges the settings for shared, user and installation during construction. @@ -265,18 +265,18 @@ public: class MergedSettings final { private: - MergedSettings& operator = (MergedSettings const &) = delete; - MergedSettings(MergedSettings const &) = delete; + MergedSettings& operator=(MergedSettings const&) = delete; + MergedSettings(MergedSettings const&) = delete; - void merge(const NodeJava & share, const NodeJava & user); + void merge(const NodeJava& share, const NodeJava& user); bool m_bEnabled; OUString m_sClassPath; - ::std::vector< OUString> m_vmParams; + ::std::vector m_vmParams; - ::std::vector< OUString> m_JRELocations; + ::std::vector m_JRELocations; CNodeJavaInfo m_javaInfo; @@ -286,11 +286,11 @@ public: /** the default is true. */ - bool getEnabled() const { return m_bEnabled;} + bool getEnabled() const { return m_bEnabled; } - const OUString & getUserClassPath() const { return m_sClassPath;} + const OUString& getUserClassPath() const { return m_sClassPath; } - ::std::vector< OString> getVmParametersUtf8() const; + ::std::vector getVmParametersUtf8() const; /** returns a JavaInfo structure representing the node /java/javaInfo. Every time a new JavaInfo structure is created which needs to be freed by the caller. @@ -300,7 +300,7 @@ public: /** returns the value of the attribute /java/javaInfo[@vendorUpdate]. */ - OString const & getJavaInfoAttrVendorUpdate() const { return m_javaInfo.sAttrVendorUpdate;} + OString const& getJavaInfoAttrVendorUpdate() const { return m_javaInfo.sAttrVendorUpdate; } #ifdef _WIN32 /** returns the javaInfo@autoSelect attribute. @@ -311,15 +311,14 @@ public: bool getJavaInfoAttrAutoSelect() const; #endif - void getVmParametersArray(std::vector * parParameters) const; + void getVmParametersArray(std::vector* parParameters) const; - const ::std::vector< OUString> & getJRELocations() const { return m_JRELocations;} + const ::std::vector& getJRELocations() const { return m_JRELocations; } }; - struct VersionInfo { - ::std::vector< OUString> vecExcludeVersions; + ::std::vector vecExcludeVersions; OUString sMinVersion; OUString sMaxVersion; }; diff --git a/jvmfwk/inc/fwkbase.hxx b/jvmfwk/inc/fwkbase.hxx index 04f432b4a942..be14511a4a4b 100644 --- a/jvmfwk/inc/fwkbase.hxx +++ b/jvmfwk/inc/fwkbase.hxx @@ -29,7 +29,6 @@ namespace jfw { - struct VersionInfo; class VendorSettings @@ -40,14 +39,13 @@ class VendorSettings public: VendorSettings(); - std::optional getVersionInformation(const OUString & sVendor) const; + std::optional getVersionInformation(const OUString& sVendor) const; }; /* The class offers functions to retrieve verified bootstrap parameters. */ -namespace BootParams +namespace BootParams { - /* Gets the file URL to the JRE which has been determined by the bootstrap parameter UNO_JAVA_JFW_JREHOME or UNO_JAVA_JFW_ENV_JREHOME. @@ -55,7 +53,7 @@ namespace BootParams */ OUString getJREHome(); -::std::vector< OString> getVMParameters(); +::std::vector getVMParameters(); OUString getUserData(); @@ -74,7 +72,6 @@ OUString getClasspathUrls(); } //end namespace - enum JFW_MODE { JFW_MODE_APPLICATION, @@ -87,9 +84,9 @@ JFW_MODE getMode(); /** creates the -Djava.class.path option with the complete classpath, including the paths which are set by UNO_JAVA_JFW_CLASSPATH_URLS. */ -OString makeClassPathOption(OUString const & sUserClassPath); +OString makeClassPathOption(OUString const& sUserClassPath); -OString getSettingsPath( const OUString & sURL); +OString getSettingsPath(const OUString& sURL); /** Get the system path to the javasettings.xml Converts the URL returned from getUserSettingsURL to a diff --git a/jvmfwk/inc/libxmlutil.hxx b/jvmfwk/inc/libxmlutil.hxx index 31332f3cea57..75cd022acd3d 100644 --- a/jvmfwk/inc/libxmlutil.hxx +++ b/jvmfwk/inc/libxmlutil.hxx @@ -28,35 +28,35 @@ namespace jfw class CXPathObjectPtr { xmlXPathObject* _object; - CXPathObjectPtr & operator = (const CXPathObjectPtr&) = delete; + CXPathObjectPtr& operator=(const CXPathObjectPtr&) = delete; CXPathObjectPtr(const CXPathObjectPtr&) = delete; + public: CXPathObjectPtr(); CXPathObjectPtr(xmlXPathObject*); ~CXPathObjectPtr(); /** Takes ownership of xmlXPathObject */ - CXPathObjectPtr & operator = (xmlXPathObject* pObj); - xmlXPathObject* operator -> () { return _object;} - operator xmlXPathObject* () const { return _object;} + CXPathObjectPtr& operator=(xmlXPathObject* pObj); + xmlXPathObject* operator->() { return _object; } + operator xmlXPathObject*() const { return _object; } }; - class CXPathContextPtr { xmlXPathContext* _object; CXPathContextPtr(const jfw::CXPathContextPtr&) = delete; - CXPathContextPtr & operator = (const CXPathContextPtr&) = delete; + CXPathContextPtr& operator=(const CXPathContextPtr&) = delete; + public: CXPathContextPtr(); CXPathContextPtr(xmlXPathContextPtr aContext); - CXPathContextPtr & operator = (xmlXPathContextPtr pObj); + CXPathContextPtr& operator=(xmlXPathContextPtr pObj); ~CXPathContextPtr(); - operator xmlXPathContext* () const { return _object;} + operator xmlXPathContext*() const { return _object; } }; - class CXmlDocPtr { xmlDoc* _object; @@ -64,35 +64,33 @@ class CXmlDocPtr CXmlDocPtr(const CXmlDocPtr&) = delete; public: - CXmlDocPtr & operator = (const CXmlDocPtr&); + CXmlDocPtr& operator=(const CXmlDocPtr&); CXmlDocPtr(); CXmlDocPtr(xmlDoc* aDoc); /** Takes ownership of xmlDoc */ - CXmlDocPtr & operator = (xmlDoc* pObj); + CXmlDocPtr& operator=(xmlDoc* pObj); ~CXmlDocPtr(); - operator xmlDoc* () const { return _object;} + operator xmlDoc*() const { return _object; } }; - class CXmlCharPtr { xmlChar* _object; CXmlCharPtr(const CXmlCharPtr&) = delete; - CXmlCharPtr & operator = (const CXmlCharPtr&) = delete; + CXmlCharPtr& operator=(const CXmlCharPtr&) = delete; + public: CXmlCharPtr(); CXmlCharPtr(xmlChar* aDoc); - explicit CXmlCharPtr(const OUString &); + explicit CXmlCharPtr(const OUString&); ~CXmlCharPtr(); - CXmlCharPtr & operator = (xmlChar* pObj); - operator xmlChar* () const { return _object;} - operator OUString (); - operator OString () { return reinterpret_cast(_object);} + CXmlCharPtr& operator=(xmlChar* pObj); + operator xmlChar*() const { return _object; } + operator OUString(); + operator OString() { return reinterpret_cast(_object); } }; - - } #endif diff --git a/jvmfwk/inc/vendorbase.hxx b/jvmfwk/inc/vendorbase.hxx index 7e98a2409c35..47e407a1b4a2 100644 --- a/jvmfwk/inc/vendorbase.hxx +++ b/jvmfwk/inc/vendorbase.hxx @@ -28,8 +28,6 @@ namespace jfw_plugin { - - //Used by subclasses of VendorBase to build paths to Java runtime #if defined(JAVA_ARCH) #define JFW_PLUGIN_ARCH JAVA_ARCH @@ -49,17 +47,17 @@ namespace jfw_plugin #define JFW_PLUGIN_ARCH "ppc" #elif defined MIPS #ifdef OSL_BIGENDIAN -# define JFW_PLUGIN_ARCH "mips" +#define JFW_PLUGIN_ARCH "mips" #else /* FIXME: do JDKs have some JDK-specific define? This is for OpenJDK at least, but probably not true for Lemotes JDK */ -# define JFW_PLUGIN_ARCH "mipsel" +#define JFW_PLUGIN_ARCH "mipsel" #endif #elif defined MIPS64 #ifdef OSL_BIGENDIAN -# define JFW_PLUGIN_ARCH "mips64" +#define JFW_PLUGIN_ARCH "mips64" #else -# define JFW_PLUGIN_ARCH "mips64el" +#define JFW_PLUGIN_ARCH "mips64el" #endif #elif defined S390X #define JFW_PLUGIN_ARCH "s390x" @@ -81,14 +79,13 @@ OpenJDK at least, but probably not true for Lemotes JDK */ #error unknown platform #endif // SPARC, INTEL, POWERPC, MIPS, MIPS64, ARM, IA64, M68K, HPPA, ALPHA - class MalformedVersionException final : public std::exception { public: virtual ~MalformedVersionException() override; }; -class VendorBase: public salhelper::SimpleReferenceObject +class VendorBase : public salhelper::SimpleReferenceObject { public: VendorBase(); @@ -121,18 +118,18 @@ public: Key - value pairs of the system properties of the JRE. */ - const OUString & getVendor() const; - const OUString & getVersion() const; - const OUString & getHome() const; - const OUString & getRuntimeLibrary() const; - const OUString & getLibraryPath() const; + const OUString& getVendor() const; + const OUString& getVersion() const; + const OUString& getHome() const; + const OUString& getRuntimeLibrary() const; + const OUString& getLibraryPath() const; bool isValidArch() const; - /* determines if prior to running java something has to be done, + /* determines if prior to running java something has to be done, like setting the LD_LIBRARY_PATH. This implementation checks if an LD_LIBRARY_PATH (getLD_LIBRARY_PATH) needs to be set and if so, needsRestart returns true. */ - bool needsRestart() const; + bool needsRestart() const; /* compares versions of this vendor. MUST be overridden in a derived class. @@ -157,8 +154,7 @@ protected: false - the object could not completely initialize. In this case it will be discarded by the caller. */ - virtual bool initialize( - std::vector > props); + virtual bool initialize(std::vector> props); /* returns relative file URLs to the runtime library. For example "/bin/client/jvm.dll" @@ -174,13 +170,11 @@ protected: OUString m_sLD_LIBRARY_PATH; OUString m_sArch; - - typedef rtl::Reference (* createInstance_func) (); - friend rtl::Reference createInstance( - createInstance_func pFunc, - const std::vector >& properties); + typedef rtl::Reference (*createInstance_func)(); + friend rtl::Reference + createInstance(createInstance_func pFunc, + const std::vector>& properties); }; - } #endif diff --git a/jvmfwk/plugins/sunmajor/pluginlib/gnujre.hxx b/jvmfwk/plugins/sunmajor/pluginlib/gnujre.hxx index 4826ea720d7f..dd3e15cb99c0 100644 --- a/jvmfwk/plugins/sunmajor/pluginlib/gnujre.hxx +++ b/jvmfwk/plugins/sunmajor/pluginlib/gnujre.hxx @@ -24,26 +24,23 @@ namespace jfw_plugin { - -class GnuInfo: public VendorBase +class GnuInfo : public VendorBase { private: OUString m_sJavaHome; + public: - static char const* const* getJavaExePaths(int * size); + static char const* const* getJavaExePaths(int* size); static rtl::Reference createInstance(); - virtual char const* const* getRuntimePaths(int * size) override; + virtual char const* const* getRuntimePaths(int* size) override; virtual char const* const* getLibraryPaths(int* size) override; - virtual bool initialize( - std::vector > props) override; + virtual bool initialize(std::vector> props) override; virtual int compareVersions(const OUString& sSecond) const override; - }; - } #endif diff --git a/jvmfwk/plugins/sunmajor/pluginlib/otherjre.hxx b/jvmfwk/plugins/sunmajor/pluginlib/otherjre.hxx index 57b3a5e39639..f722234ef24b 100644 --- a/jvmfwk/plugins/sunmajor/pluginlib/otherjre.hxx +++ b/jvmfwk/plugins/sunmajor/pluginlib/otherjre.hxx @@ -26,19 +26,17 @@ namespace jfw_plugin { /* Do not forget to put this class in the vendor map in vendorlist.cxx */ -class OtherInfo: public VendorBase +class OtherInfo : public VendorBase { public: - static char const* const* getJavaExePaths(int * size); + static char const* const* getJavaExePaths(int* size); static rtl::Reference createInstance(); - virtual char const* const* getRuntimePaths(int * size) override; + virtual char const* const* getRuntimePaths(int* size) override; virtual char const* const* getLibraryPaths(int* size) override; virtual int compareVersions(const OUString& sSecond) const override; - }; - } #endif diff --git a/jvmfwk/plugins/sunmajor/pluginlib/sunjre.hxx b/jvmfwk/plugins/sunmajor/pluginlib/sunjre.hxx index 781e2dd782b4..773f40080bab 100644 --- a/jvmfwk/plugins/sunmajor/pluginlib/sunjre.hxx +++ b/jvmfwk/plugins/sunmajor/pluginlib/sunjre.hxx @@ -24,20 +24,18 @@ namespace jfw_plugin { - -class SunInfo: public VendorBase +class SunInfo : public VendorBase { public: - static char const* const* getJavaExePaths(int * size); + static char const* const* getJavaExePaths(int* size); static rtl::Reference createInstance(); - virtual char const* const* getRuntimePaths(int * size) override; + virtual char const* const* getRuntimePaths(int* size) override; virtual char const* const* getLibraryPaths(int* size) override; virtual int compareVersions(const OUString& sSecond) const override; }; - } #endif diff --git a/jvmfwk/plugins/sunmajor/pluginlib/sunversion.hxx b/jvmfwk/plugins/sunmajor/pluginlib/sunversion.hxx index a493fb5a8b1c..3c181ed3b7be 100644 --- a/jvmfwk/plugins/sunmajor/pluginlib/sunversion.hxx +++ b/jvmfwk/plugins/sunmajor/pluginlib/sunversion.hxx @@ -22,7 +22,8 @@ #include -namespace jfw_plugin { +namespace jfw_plugin +{ // Define OSL_DEBUG_LEVEL >= 2 to run a test when this lib is loaded /* SunVersion is used to compare java versions based on a string, as taken @@ -68,7 +69,7 @@ class SunVersion final Rel_RC2, Rel_RC3 #if defined(FREEBSD) - , + , Rel_FreeBSD #endif }; @@ -79,8 +80,9 @@ class SunVersion final char m_nUpdateSpecial; PreRelease m_preRelease; + public: - explicit SunVersion(const char * szVer); + explicit SunVersion(const char* szVer); explicit SunVersion(const OUString& usVer); ~SunVersion(); @@ -88,16 +90,16 @@ public: Pre-release versions are taken into account. 1.5.0-beta > 1.5.0-ea > 1.4.2 */ - bool operator > (const SunVersion& ver) const; - bool operator < (const SunVersion& ver) const; - bool operator == (const SunVersion& ver) const; + bool operator>(const SunVersion& ver) const; + bool operator<(const SunVersion& ver) const; + bool operator==(const SunVersion& ver) const; /** Test if the version is compatible tu SUN's versioning scheme */ - operator bool () { return m_bValid;} + operator bool() { return m_bValid; } private: - bool init(const char * szVer); + bool init(const char* szVer); bool m_bValid; @@ -105,9 +107,8 @@ private: "ea" is passed then Rel_EA is returned. If the string is no pre release then Rel_NONE is returned. */ - static PreRelease getPreRelease(const char *szRel); + static PreRelease getPreRelease(const char* szRel); }; - } #endif // INCLUDED_JVMFWK_PLUGINS_SUNMAJOR_PLUGINLIB_SUNVERSION_HXX diff --git a/jvmfwk/plugins/sunmajor/pluginlib/util_cocoa.hxx b/jvmfwk/plugins/sunmajor/pluginlib/util_cocoa.hxx index ebada192408f..ae43cee91c42 100644 --- a/jvmfwk/plugins/sunmajor/pluginlib/util_cocoa.hxx +++ b/jvmfwk/plugins/sunmajor/pluginlib/util_cocoa.hxx @@ -7,7 +7,7 @@ #include -bool JvmfwkUtil_isLoadableJVM( OUString const & aURL ); +bool JvmfwkUtil_isLoadableJVM(OUString const& aURL); #endif -- cgit v1.2.3