Kaydet (Commit) 14d45665 authored tarafından Noel Grandin's avatar Noel Grandin

loplugin:constmethod in codemaker,registry,store

Change-Id: Ie75875974f054ff79bd64b1c261e79e2b78eb7fc
Reviewed-on: https://gerrit.libreoffice.org/43540Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 8f8a1e30
......@@ -273,7 +273,7 @@ FileStream::~FileStream()
osl_closeFile(m_file);
}
bool FileStream::isValid()
bool FileStream::isValid() const
{
if ( m_file )
return true;
......
......@@ -320,7 +320,7 @@ OString CppuOptions::prepareHelp()
return help;
}
OString CppuOptions::prepareVersion()
OString CppuOptions::prepareVersion() const
{
OString version = m_program + " Version 2.0\n\n";
return version;
......
......@@ -32,7 +32,7 @@ public:
OString prepareHelp() override;
OString prepareVersion();
OString prepareVersion() const;
protected:
};
......
......@@ -167,7 +167,7 @@ public:
CppuOptions const & options);
void dumpDependedTypes(
codemaker::GeneratedTypeSet & generated, CppuOptions const & options);
codemaker::GeneratedTypeSet & generated, CppuOptions const & options) const;
virtual void dumpHdlFile(
FileStream & out, codemaker::cppumaker::Includes & includes) {
......@@ -176,7 +176,7 @@ public:
virtual void dumpHppFile(FileStream& o, codemaker::cppumaker::Includes & includes) = 0;
OUString dumpHeaderDefine(FileStream& o, OUString const & extension);
OUString dumpHeaderDefine(FileStream& o, OUString const & extension) const;
void dumpGetCppuType(FileStream & out);
......@@ -198,7 +198,7 @@ public:
OUString getTypeClass(OUString const & name, bool cStyle = false);
void dumpCppuGetType(
FileStream & out, OUString const & name, OUString const * ownName = nullptr);
FileStream & out, OUString const & name, OUString const * ownName = nullptr) const;
sal_uInt32 getInheritedMemberCount();
......@@ -454,7 +454,7 @@ bool CppuType::dumpFile(
}
void CppuType::dumpDependedTypes(
codemaker::GeneratedTypeSet & generated, CppuOptions const & options)
codemaker::GeneratedTypeSet & generated, CppuOptions const & options) const
{
if (!options.isValid("-nD")) {
codemaker::cppumaker::Dependencies::Map const & map
......@@ -466,7 +466,7 @@ void CppuType::dumpDependedTypes(
}
OUString CppuType::dumpHeaderDefine(
FileStream & out, OUString const & extension)
FileStream & out, OUString const & extension) const
{
OUString def(
"INCLUDED_" + name_.replace('.', '_').toAsciiUpperCase() + "_"
......@@ -849,7 +849,7 @@ void CppuType::dumpType(
}
void CppuType::dumpCppuGetType(
FileStream & out, OUString const & name, OUString const * ownName)
FileStream & out, OUString const & name, OUString const * ownName) const
{
//TODO: What are these calls good for?
OUString nucleus;
......@@ -1110,16 +1110,16 @@ public:
virtual void dumpDeclaration(FileStream& o) override;
void dumpHppFile(FileStream& o, codemaker::cppumaker::Includes & includes) override;
void dumpAttributes(FileStream& o);
void dumpMethods(FileStream& o);
void dumpAttributes(FileStream& o) const;
void dumpMethods(FileStream& o) const;
void dumpNormalGetCppuType(FileStream& o) override;
void dumpComprehensiveGetCppuType(FileStream& o) override;
void dumpCppuAttributeRefs(FileStream& o, sal_uInt32& index);
void dumpCppuMethodRefs(FileStream& o, sal_uInt32& index);
void dumpCppuAttributes(FileStream& o, sal_uInt32& index);
void dumpCppuMethods(FileStream& o, sal_uInt32& index);
void dumpAttributesCppuDecl(FileStream & out, std::set< OUString > * seen);
void dumpMethodsCppuDecl(FileStream & out, std::set< OUString > * seen);
void dumpAttributesCppuDecl(FileStream & out, std::set< OUString > * seen) const;
void dumpMethodsCppuDecl(FileStream & out, std::set< OUString > * seen) const;
private:
virtual void addComprehensiveGetCppuTypeIncludes(
......@@ -1131,11 +1131,11 @@ private:
void dumpExceptionTypeName(
FileStream & out, OUString const & prefix, sal_uInt32 index,
OUString const & name);
OUString const & name) const;
sal_Int32 dumpExceptionTypeNames(
FileStream & out, OUString const & prefix,
std::vector< OUString > const & exceptions, bool runtimeException);
std::vector< OUString > const & exceptions, bool runtimeException) const;
rtl::Reference< unoidl::InterfaceTypeEntity > entity_;
bool m_isDeprecated;
......@@ -1196,7 +1196,7 @@ void InterfaceType::dumpHppFile(
out << "}\n\n#endif // "<< headerDefine << "\n";
}
void InterfaceType::dumpAttributes(FileStream & out)
void InterfaceType::dumpAttributes(FileStream & out) const
{
if (!entity_->getDirectAttributes().empty()) {
out << "\n" << indent() << "// Attributes\n";
......@@ -1219,7 +1219,7 @@ void InterfaceType::dumpAttributes(FileStream & out)
}
}
void InterfaceType::dumpMethods(FileStream & out)
void InterfaceType::dumpMethods(FileStream & out) const
{
if (!entity_->getDirectMethods().empty()) {
out << "\n" << indent() << "// Methods\n";
......@@ -1551,7 +1551,7 @@ void InterfaceType::dumpCppuMethods(FileStream & out, sal_uInt32 & index)
}
void InterfaceType::dumpAttributesCppuDecl(
FileStream & out, std::set< OUString > * seen)
FileStream & out, std::set< OUString > * seen) const
{
assert(seen != nullptr);
for (const unoidl::InterfaceTypeEntity::Attribute& attr : entity_->getDirectAttributes()) {
......@@ -1572,7 +1572,7 @@ void InterfaceType::dumpAttributesCppuDecl(
}
void InterfaceType::dumpMethodsCppuDecl(
FileStream & out, std::set< OUString > * seen)
FileStream & out, std::set< OUString > * seen) const
{
assert(seen != nullptr);
for (const unoidl::InterfaceTypeEntity::Method& method : entity_->getDirectMethods()) {
......@@ -1586,7 +1586,7 @@ void InterfaceType::dumpMethodsCppuDecl(
void InterfaceType::dumpExceptionTypeName(
FileStream & out, OUString const & prefix, sal_uInt32 index,
OUString const & name)
OUString const & name) const
{
out << indent() << "::rtl::OUString the_" << prefix << "ExceptionName"
<< index << "( \"" << name << "\" );\n";
......@@ -1594,7 +1594,7 @@ void InterfaceType::dumpExceptionTypeName(
sal_Int32 InterfaceType::dumpExceptionTypeNames(
FileStream & out, OUString const & prefix,
std::vector< OUString > const & exceptions, bool runtimeException)
std::vector< OUString > const & exceptions, bool runtimeException) const
{
sal_Int32 count = 0;
for (const OUString& ex : exceptions) {
......
......@@ -242,7 +242,7 @@ OString JavaOptions::prepareHelp()
return help;
}
OString JavaOptions::prepareVersion()
OString JavaOptions::prepareVersion() const
{
OString version(m_program);
version += " Version 2.0\n\n";
......
......@@ -32,7 +32,7 @@ public:
OString prepareHelp() override;
OString prepareVersion();
OString prepareVersion() const;
protected:
};
......
......@@ -43,12 +43,12 @@ public:
FileStream();
~FileStream();
bool isValid();
bool isValid() const;
void createTempFile(const ::rtl::OString& sPath);
void close();
const ::rtl::OString& getName() { return m_name; }
const ::rtl::OString& getName() const { return m_name; }
bool write(void const * buffer, sal_uInt64 size);
......
......@@ -55,7 +55,7 @@ public:
/// @throws IllegalArgument
const OString& getOption(const ::rtl::OString& option) const;
const StringVector& getInputFiles() { return m_inputFiles;}
const StringVector& getInputFiles() const { return m_inputFiles;}
const StringVector& getExtraInputFiles() const
{ return m_extra_input_files; }
......
......@@ -179,7 +179,7 @@ public:
friend class RegistryKeyNames;
/// returns the used registry Api.
const Registry_Api* getApi() { return m_pApi; }
const Registry_Api* getApi() const { return m_pApi; }
protected:
/// stores the used and initialized registry Api.
......@@ -206,7 +206,7 @@ public:
inline RegistryKey getElement(sal_uInt32 index);
/// returns the length of the array.
inline sal_uInt32 getLength();
inline sal_uInt32 getLength() const;
friend class RegistryKey;
protected:
......@@ -244,7 +244,7 @@ public:
inline rtl::OUString getElement(sal_uInt32 index);
/// returns the length of the array.
inline sal_uInt32 getLength();
inline sal_uInt32 getLength() const;
friend class RegistryKey;
protected:
......@@ -591,7 +591,7 @@ inline RegistryKey RegistryKeyArray::getElement(sal_uInt32 index)
return RegistryKey();
}
inline sal_uInt32 RegistryKeyArray::getLength()
inline sal_uInt32 RegistryKeyArray::getLength() const
{
return m_length;
}
......@@ -626,7 +626,7 @@ inline rtl::OUString RegistryKeyNames::getElement(sal_uInt32 index)
return rtl::OUString();
}
inline sal_uInt32 RegistryKeyNames::getLength()
inline sal_uInt32 RegistryKeyNames::getLength() const
{
return m_length;
}
......
......@@ -194,7 +194,7 @@ public:
void setMethodParameterData(
sal_uInt16 methodIndex, sal_uInt16 parameterIndex,
RTParamMode flags, rtl::OUString const & name,
rtl::OUString const & typeName)
rtl::OUString const & typeName) const
{
if (!typereg_writer_setMethodParameterData(
m_handle, methodIndex, parameterIndex, flags, name.pData,
......
......@@ -970,7 +970,7 @@ RegError ORegKey::getUnicodeListValue(const OUString& valueName, sal_Unicode***
RegError ORegKey::getResolvedKeyName(const OUString& keyName,
OUString& resolvedName)
OUString& resolvedName) const
{
if (keyName.isEmpty())
return RegError::INVALID_KEYNAME;
......@@ -1004,7 +1004,7 @@ sal_uInt32 ORegKey::countSubKeys()
return count;
}
OStoreDirectory ORegKey::getStoreDir()
OStoreDirectory ORegKey::getStoreDir() const
{
OStoreDirectory rStoreDir;
OUString fullPath;
......
......@@ -91,7 +91,7 @@ public:
sal_uInt32* pLen) const;
RegError getResolvedKeyName(const OUString& keyName,
OUString& resolvedName);
OUString& resolvedName) const;
bool isDeleted() const
{ return m_bDeleted; }
......@@ -116,7 +116,7 @@ public:
const store::OStoreFile& getStoreFile() const
{ return m_pRegistry->getStoreFile(); }
store::OStoreDirectory getStoreDir();
store::OStoreDirectory getStoreDir() const;
const OUString& getName() const
{ return m_name; }
......
This diff is collapsed.
......@@ -187,7 +187,7 @@ struct CPInfo
CPInfo(CPInfoTag tag, struct CPInfo* prev);
sal_uInt32 getBlopSize();
sal_uInt32 getBlopSize() const;
sal_uInt32 toBlop(sal_uInt8* buffer);
};
......@@ -204,7 +204,7 @@ CPInfo::CPInfo(CPInfoTag tag, struct CPInfo* prev)
}
}
sal_uInt32 CPInfo::getBlopSize()
sal_uInt32 CPInfo::getBlopSize() const
{
sal_uInt32 size = sizeof(sal_uInt32) /* size */ + sizeof(sal_uInt16) /* tag */;
......@@ -518,7 +518,7 @@ public:
sal_uInt16 excCount,
const OString& doku);
void setExcName(sal_uInt16 excIndex, const OString& name);
void setExcName(sal_uInt16 excIndex, const OString& name) const;
protected:
......@@ -550,7 +550,7 @@ void MethodEntry::setData(const OString& name,
reallocExcs(excCount);
}
void MethodEntry::setExcName(sal_uInt16 excIndex, const OString& name)
void MethodEntry::setExcName(sal_uInt16 excIndex, const OString& name) const
{
if (excIndex < m_excCount)
{
......@@ -649,7 +649,7 @@ public:
~TypeWriter();
void setSuperType(sal_uInt16 index, OString const & name);
void setSuperType(sal_uInt16 index, OString const & name) const;
void createBlop(); // throws std::bad_alloc
};
......@@ -708,7 +708,7 @@ TypeWriter::~TypeWriter()
delete[] m_references;
}
void TypeWriter::setSuperType(sal_uInt16 index, OString const & name)
void TypeWriter::setSuperType(sal_uInt16 index, OString const & name) const
{
m_superTypeNames[index] = name;
}
......
......@@ -395,7 +395,7 @@ public:
}
}
ImplTextEncodingData const * get(rtl_TextEncoding encoding) {
ImplTextEncodingData const * get(rtl_TextEncoding encoding) const {
return (*function_)(encoding);
}
......
......@@ -688,7 +688,7 @@ void OStorePageBIOS::cleanup_Impl()
* Low Level: Precond: initialized, exclusive access.
*/
storeError OStorePageBIOS::read (
sal_uInt32 nAddr, void *pData, sal_uInt32 nSize)
sal_uInt32 nAddr, void *pData, sal_uInt32 nSize) const
{
// Check precond.
if (!m_xLockBytes.is())
......@@ -703,7 +703,7 @@ storeError OStorePageBIOS::read (
* Low Level: Precond: initialized, writeable, exclusive access.
*/
storeError OStorePageBIOS::write (
sal_uInt32 nAddr, const void *pData, sal_uInt32 nSize)
sal_uInt32 nAddr, const void *pData, sal_uInt32 nSize) const
{
// Check precond.
if (!m_xLockBytes.is())
......@@ -874,7 +874,7 @@ storeError OStorePageBIOS::loadObjectAt (OStorePageObject & rPage, sal_uInt32 nA
* loadObjectAt_Impl.
* Internal: Precond: initialized, readable, exclusive access.
*/
storeError OStorePageBIOS::loadObjectAt_Impl (OStorePageObject & rPage, sal_uInt32 nAddr)
storeError OStorePageBIOS::loadObjectAt_Impl (OStorePageObject & rPage, sal_uInt32 nAddr) const
{
storeError eErrCode = m_xCache->lookupPageAt (rPage.get(), nAddr);
if (eErrCode != store_E_NotExists)
......@@ -920,7 +920,7 @@ storeError OStorePageBIOS::saveObjectAt (OStorePageObject & rPage, sal_uInt32 nA
* saveObjectAt_Impl.
* Internal: Precond: initialized, writeable, exclusive access.
*/
storeError OStorePageBIOS::saveObjectAt_Impl (OStorePageObject & rPage, sal_uInt32 nAddr)
storeError OStorePageBIOS::saveObjectAt_Impl (OStorePageObject & rPage, sal_uInt32 nAddr) const
{
// Guard page (incl. set location).
storeError eErrCode = rPage.guard (nAddr);
......
......@@ -65,12 +65,12 @@ public:
/** read.
*/
storeError read (
sal_uInt32 nAddr, void *pData, sal_uInt32 nSize);
sal_uInt32 nAddr, void *pData, sal_uInt32 nSize) const;
/** write.
*/
storeError write (
sal_uInt32 nAddr, const void *pData, sal_uInt32 nSize);
sal_uInt32 nAddr, const void *pData, sal_uInt32 nSize) const;
/** isWriteable.
*/
......@@ -163,9 +163,9 @@ private:
/** Page Maintenance.
*/
storeError loadObjectAt_Impl (
OStorePageObject & rPage, sal_uInt32 nAddr);
OStorePageObject & rPage, sal_uInt32 nAddr) const;
storeError saveObjectAt_Impl (
OStorePageObject & rPage, sal_uInt32 nAddr);
OStorePageObject & rPage, sal_uInt32 nAddr) const;
OStorePageBIOS (const OStorePageBIOS&) = delete;
OStorePageBIOS& operator= (const OStorePageBIOS&) = delete;
......
......@@ -211,7 +211,7 @@ storeError OStoreIndirectionPageObject::verify (sal_uInt32 nAddr) const
storeError OStoreIndirectionPageObject::read (
sal_uInt16 nSingle,
OStoreDataPageObject &rData,
OStorePageBIOS &rBIOS)
OStorePageBIOS &rBIOS) const
{
PageHolderObject< page > xImpl (m_xPage);
page const & rPage = (*xImpl);
......@@ -237,7 +237,7 @@ storeError OStoreIndirectionPageObject::read (
sal_uInt16 nDouble,
sal_uInt16 nSingle,
OStoreDataPageObject &rData,
OStorePageBIOS &rBIOS)
OStorePageBIOS &rBIOS) const
{
PageHolderObject< page > xImpl (m_xPage);
page const & rPage = (*xImpl);
......@@ -270,7 +270,7 @@ storeError OStoreIndirectionPageObject::read (
sal_uInt16 nDouble,
sal_uInt16 nSingle,
OStoreDataPageObject &rData,
OStorePageBIOS &rBIOS)
OStorePageBIOS &rBIOS) const
{
PageHolderObject< page > xImpl (m_xPage);
page const & rPage = (*xImpl);
......@@ -723,7 +723,7 @@ OStoreDirectoryPageObject::scope (
storeError OStoreDirectoryPageObject::read (
sal_uInt32 nPage,
OStoreDataPageObject &rData,
OStorePageBIOS &rBIOS)
OStorePageBIOS &rBIOS) const
{
// Determine scope and link indices.
page::DataBlock::LinkDescriptor aLink;
......
......@@ -80,7 +80,7 @@ struct OStoreDataPageData : public store::PageData
/** guard (external representation).
*/
void guard() { (void) this; /* loplugin:staticmethods */ }
void guard() const { (void) this; /* loplugin:staticmethods */ }
/** verify (external representation).
*/
......@@ -216,20 +216,20 @@ public:
storeError read (
sal_uInt16 nSingle,
OStoreDataPageObject &rData,
OStorePageBIOS &rBIOS);
OStorePageBIOS &rBIOS) const;
storeError read (
sal_uInt16 nDouble,
sal_uInt16 nSingle,
OStoreDataPageObject &rData,
OStorePageBIOS &rBIOS);
OStorePageBIOS &rBIOS) const;
storeError read (
sal_uInt16 nTriple,
sal_uInt16 nDouble,
sal_uInt16 nSingle,
OStoreDataPageObject &rData,
OStorePageBIOS &rBIOS);
OStorePageBIOS &rBIOS) const;
/** write (indirect data page).
*/
......@@ -707,7 +707,7 @@ public:
storeError read (
sal_uInt32 nPage,
OStoreDataPageObject &rData,
OStorePageBIOS &rBIOS);
OStorePageBIOS &rBIOS) const;
/** write (external data page).
*/
......
......@@ -301,7 +301,7 @@ storeError OStoreBTreeNodeObject::remove (
* testInvariant.
* Precond: root node page loaded.
*/
void OStoreBTreeRootObject::testInvariant (char const * message)
void OStoreBTreeRootObject::testInvariant (char const * message) const
{
OSL_PRECOND(m_xPage.get() != nullptr, "OStoreBTreeRootObject::testInvariant(): Null pointer");
SAL_WARN_IF( (m_xPage->location() - m_xPage->size()) != 0, "store", message);
......@@ -380,7 +380,7 @@ storeError OStoreBTreeRootObject::find_lookup (
OStoreBTreeNodeObject & rNode, // [out]
sal_uInt16 & rIndex, // [out]
OStorePageKey const & rKey,
OStorePageBIOS & rBIOS)
OStorePageBIOS & rBIOS) const
{
// Init node w/ root page.
testInvariant("OStoreBTreeRootObject::find_lookup(): enter");
......
......@@ -256,7 +256,7 @@ public:
OStoreBTreeNodeObject & rNode, // [out]
sal_uInt16 & rIndex, // [out]
OStorePageKey const & rKey,
OStorePageBIOS & rBIOS);
OStorePageBIOS & rBIOS) const;
/** find_insert (possibly with split()).
* Precond: root node page loaded.
......@@ -271,7 +271,7 @@ private:
/** testInvariant.
* Precond: root node page loaded.
*/
void testInvariant (char const * message);
void testInvariant (char const * message) const;
/** change (Root).
*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment