src: fixed some clang tidy warnings
* implemented CxxDeclName constructors that just move the members * removed empty destructors because they disable default move constructors * removed some unnecessary code * replaced ".size() == 0" with ".empty()" because it's more explicit
This commit is contained in:
@@ -41,7 +41,7 @@ void Graph::forEachToken(std::function<void(Token*)> func) const
|
||||
forEachEdge(func);
|
||||
}
|
||||
|
||||
Node* Graph::createNode(Id id, NodeType type, NameHierarchy nameHierarchy, bool defined)
|
||||
Node* Graph::createNode(Id id, NodeType type, const NameHierarchy& nameHierarchy, bool defined)
|
||||
{
|
||||
Node* n = getNodeById(id);
|
||||
if (n)
|
||||
|
||||
@@ -27,7 +27,7 @@ public:
|
||||
void forEachEdge(std::function<void(Edge*)> func) const;
|
||||
void forEachToken(std::function<void(Token*)> func) const;
|
||||
|
||||
Node* createNode(Id id, NodeType type, NameHierarchy nameHierarchy, bool defined);
|
||||
Node* createNode(Id id, NodeType type, const NameHierarchy& nameHierarchy, bool defined);
|
||||
Edge* createEdge(Id id, Edge::EdgeType type, Node* from, Node* to);
|
||||
|
||||
size_t getNodeCount() const;
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include "data/graph/token_component/TokenComponentStatic.h"
|
||||
#include "data/graph/token_component/TokenComponentFilePath.h"
|
||||
|
||||
Node::Node(Id id, NodeType type, NameHierarchy nameHierarchy, bool defined)
|
||||
Node::Node(Id id, NodeType type, const NameHierarchy& nameHierarchy, bool defined)
|
||||
: Token(id)
|
||||
, m_type(type)
|
||||
, m_nameHierarchy(nameHierarchy)
|
||||
|
||||
@@ -22,7 +22,7 @@ class Node
|
||||
: public Token
|
||||
{
|
||||
public:
|
||||
Node(Id id, NodeType type, NameHierarchy nameHierarchy, bool defined);
|
||||
Node(Id id, NodeType type, const NameHierarchy& nameHierarchy, bool defined);
|
||||
Node(const Node& other);
|
||||
virtual ~Node();
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include "utility/logging/logging.h"
|
||||
#include "utility/utilityString.h"
|
||||
|
||||
std::string NameHierarchy::serialize(NameHierarchy nameHierarchy)
|
||||
std::string NameHierarchy::serialize(const NameHierarchy& nameHierarchy)
|
||||
{
|
||||
std::string serializedName = nameDelimiterTypeToString(nameHierarchy.getDelimiter()) + "\tm";
|
||||
for (size_t i = 0; i < nameHierarchy.size(); i++)
|
||||
@@ -75,6 +75,18 @@ NameHierarchy::NameHierarchy(const std::vector<std::string>& names, const NameDe
|
||||
}
|
||||
}
|
||||
|
||||
NameHierarchy::NameHierarchy(const NameHierarchy& other)
|
||||
: m_elements(other.m_elements)
|
||||
, m_delimiter(other.m_delimiter)
|
||||
{
|
||||
}
|
||||
|
||||
NameHierarchy::NameHierarchy(NameHierarchy&& other)
|
||||
: m_elements(std::move(other.m_elements))
|
||||
, m_delimiter(other.m_delimiter)
|
||||
{
|
||||
}
|
||||
|
||||
NameHierarchy::~NameHierarchy()
|
||||
{
|
||||
}
|
||||
@@ -103,6 +115,20 @@ std::shared_ptr<NameElement> NameHierarchy::operator[](size_t pos) const
|
||||
return m_elements[pos];
|
||||
}
|
||||
|
||||
NameHierarchy& NameHierarchy::operator=(const NameHierarchy& other)
|
||||
{
|
||||
m_elements = other.m_elements;
|
||||
m_delimiter = other.m_delimiter;
|
||||
return *this;
|
||||
}
|
||||
|
||||
NameHierarchy& NameHierarchy::operator=(NameHierarchy&& other)
|
||||
{
|
||||
m_elements = std::move(other.m_elements);
|
||||
m_delimiter = other.m_delimiter;
|
||||
return *this;
|
||||
}
|
||||
|
||||
NameHierarchy NameHierarchy::getRange(size_t first, size_t last) const
|
||||
{
|
||||
NameHierarchy hierarchy(m_delimiter);
|
||||
|
||||
@@ -11,12 +11,14 @@
|
||||
class NameHierarchy
|
||||
{
|
||||
public:
|
||||
static std::string serialize(NameHierarchy nameHierarchy);
|
||||
static std::string serialize(const NameHierarchy& nameHierarchy);
|
||||
static NameHierarchy deserialize(const std::string& serializedName);
|
||||
|
||||
NameHierarchy(const NameDelimiterType delimiter);
|
||||
NameHierarchy(const std::string& name, const NameDelimiterType delimiter);
|
||||
NameHierarchy(const std::vector<std::string>& names, const NameDelimiterType delimiter);
|
||||
NameHierarchy(const NameHierarchy& other);
|
||||
NameHierarchy(NameHierarchy&& other);
|
||||
~NameHierarchy();
|
||||
|
||||
NameDelimiterType getDelimiter() const;
|
||||
@@ -27,6 +29,8 @@ public:
|
||||
|
||||
std::shared_ptr<NameElement> back() const;
|
||||
std::shared_ptr<NameElement> operator[](size_t pos) const;
|
||||
NameHierarchy& operator=(const NameHierarchy& other);
|
||||
NameHierarchy& operator=(NameHierarchy&& other);
|
||||
|
||||
NameHierarchy getRange(size_t first, size_t last) const;
|
||||
|
||||
|
||||
@@ -187,7 +187,7 @@ void ParserClientImpl::addAccess(Id nodeId, AccessKind access)
|
||||
}
|
||||
}
|
||||
|
||||
Id ParserClientImpl::addNodeHierarchy(NameHierarchy nameHierarchy, NodeType nodeType)
|
||||
Id ParserClientImpl::addNodeHierarchy(const NameHierarchy& nameHierarchy, NodeType nodeType)
|
||||
{
|
||||
if (nameHierarchy.size() == 0)
|
||||
{
|
||||
@@ -215,7 +215,7 @@ Id ParserClientImpl::addNodeHierarchy(NameHierarchy nameHierarchy, NodeType node
|
||||
return parentNodeId;
|
||||
}
|
||||
|
||||
Id ParserClientImpl::addNode(NodeType nodeType, NameHierarchy nameHierarchy)
|
||||
Id ParserClientImpl::addNode(NodeType nodeType, const NameHierarchy& nameHierarchy)
|
||||
{
|
||||
if (!m_storage)
|
||||
{
|
||||
|
||||
@@ -50,9 +50,9 @@ private:
|
||||
NodeType symbolKindToNodeType(SymbolKind symbolType) const;
|
||||
Edge::EdgeType referenceKindToEdgeType(ReferenceKind referenceKind) const;
|
||||
void addAccess(Id nodeId, AccessKind access);
|
||||
Id addNodeHierarchy(NameHierarchy nameHierarchy, NodeType nodeType = NodeType::NODE_SYMBOL);
|
||||
Id addNodeHierarchy(const NameHierarchy& nameHierarchy, NodeType nodeType = NodeType::NODE_SYMBOL);
|
||||
|
||||
Id addNode(NodeType nodeType, NameHierarchy nameHierarchy);
|
||||
Id addNode(NodeType nodeType, const NameHierarchy& nameHierarchy);
|
||||
void addFile(Id id, const FilePath& filePath, const std::string& modificationTime);
|
||||
void addSymbol(Id id, DefinitionKind definitionKind);
|
||||
Id addEdge(int type, Id sourceId, Id targetId);
|
||||
|
||||
@@ -84,7 +84,7 @@ FilePath::~FilePath()
|
||||
|
||||
boost::filesystem::path FilePath::getPath() const
|
||||
{
|
||||
return boost::filesystem::path(*(m_path.get()));
|
||||
return *(m_path.get());
|
||||
}
|
||||
|
||||
bool FilePath::empty() const
|
||||
|
||||
@@ -20,7 +20,7 @@ public:
|
||||
explicit FilePath(const char* filePath);
|
||||
explicit FilePath(const std::string& filePath);
|
||||
explicit FilePath(const boost::filesystem::path& filePath);
|
||||
FilePath(const FilePath& filePath);
|
||||
FilePath(const FilePath& other);
|
||||
FilePath(FilePath&& other);
|
||||
FilePath(const std::string& filePath, const std::string& base);
|
||||
~FilePath();
|
||||
|
||||
@@ -24,7 +24,7 @@ SharedMemoryGarbageCollector* SharedMemoryGarbageCollector::createInstance()
|
||||
s_instance = std::shared_ptr<SharedMemoryGarbageCollector>(new SharedMemoryGarbageCollector());
|
||||
}
|
||||
}
|
||||
catch (boost::interprocess::interprocess_exception& e)
|
||||
catch (boost::interprocess::interprocess_exception)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -15,10 +15,6 @@ IndexerCommandCxx::IndexerCommandCxx(
|
||||
{
|
||||
}
|
||||
|
||||
IndexerCommandCxx::~IndexerCommandCxx()
|
||||
{
|
||||
}
|
||||
|
||||
size_t IndexerCommandCxx::getByteSize(size_t stringSize) const
|
||||
{
|
||||
size_t size = IndexerCommand::getByteSize(stringSize);
|
||||
|
||||
@@ -20,7 +20,6 @@ public:
|
||||
const std::vector<FilePath>& frameworkSearchPaths,
|
||||
const std::vector<std::string>& compilerFlags);
|
||||
|
||||
virtual ~IndexerCommandCxx();
|
||||
virtual size_t getByteSize(size_t stringSize) const override;
|
||||
|
||||
std::vector<FilePath> getSystemHeaderSearchPaths() const;
|
||||
|
||||
@@ -53,10 +53,6 @@ IndexerCommandCxxCdb::IndexerCommandCxxCdb(
|
||||
{
|
||||
}
|
||||
|
||||
IndexerCommandCxxCdb::~IndexerCommandCxxCdb()
|
||||
{
|
||||
}
|
||||
|
||||
IndexerCommandType IndexerCommandCxxCdb::getIndexerCommandType() const
|
||||
{
|
||||
return getStaticIndexerCommandType();
|
||||
|
||||
@@ -29,8 +29,6 @@ public:
|
||||
const std::vector<FilePath>& systemHeaderSearchPaths,
|
||||
const std::vector<FilePath>& frameworkSearchPaths);
|
||||
|
||||
virtual ~IndexerCommandCxxCdb();
|
||||
|
||||
virtual IndexerCommandType getIndexerCommandType() const override;
|
||||
virtual size_t getByteSize(size_t stringSize) const override;
|
||||
|
||||
|
||||
@@ -19,10 +19,6 @@ IndexerCommandCxxManual::IndexerCommandCxxManual(
|
||||
{
|
||||
}
|
||||
|
||||
IndexerCommandCxxManual::~IndexerCommandCxxManual()
|
||||
{
|
||||
}
|
||||
|
||||
IndexerCommandType IndexerCommandCxxManual::getIndexerCommandType() const
|
||||
{
|
||||
return getStaticIndexerCommandType();
|
||||
|
||||
@@ -20,8 +20,6 @@ public:
|
||||
const std::vector<FilePath>& frameworkSearchPaths,
|
||||
const std::vector<std::string>& compilerFlags);
|
||||
|
||||
virtual ~IndexerCommandCxxManual();
|
||||
|
||||
virtual IndexerCommandType getIndexerCommandType() const override;
|
||||
virtual size_t getByteSize(size_t stringSize) const override;
|
||||
|
||||
|
||||
@@ -11,18 +11,13 @@ template <typename IndexerCommandType, typename ParserType>
|
||||
class IndexerCxx: public Indexer<IndexerCommandType>
|
||||
{
|
||||
public:
|
||||
virtual ~IndexerCxx();
|
||||
virtual ~IndexerCxx() = default;
|
||||
|
||||
virtual std::shared_ptr<IntermediateStorage> doIndex(
|
||||
std::shared_ptr<IndexerCommandType> indexerCommand,
|
||||
std::shared_ptr<FileRegister> fileRegister);
|
||||
};
|
||||
|
||||
template <typename IndexerCommandType, typename ParserType>
|
||||
IndexerCxx<IndexerCommandType, ParserType>::~IndexerCxx()
|
||||
{
|
||||
}
|
||||
|
||||
template <typename IndexerCommandType, typename ParserType>
|
||||
std::shared_ptr<IntermediateStorage> IndexerCxx<IndexerCommandType, ParserType>::doIndex(
|
||||
std::shared_ptr<IndexerCommandType> indexerCommand,
|
||||
|
||||
@@ -4,10 +4,6 @@
|
||||
#include "data/indexer/IndexerCommandCxxCdb.h"
|
||||
#include "data/parser/cxx/CxxParser.h"
|
||||
|
||||
IndexerFactoryModuleCxxCdb::~IndexerFactoryModuleCxxCdb()
|
||||
{
|
||||
}
|
||||
|
||||
std::shared_ptr<IndexerBase> IndexerFactoryModuleCxxCdb::createIndexer()
|
||||
{
|
||||
return std::make_shared<IndexerCxx<IndexerCommandCxxCdb, CxxParser>>();
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
class IndexerFactoryModuleCxxCdb: public IndexerFactoryModule
|
||||
{
|
||||
public:
|
||||
virtual ~IndexerFactoryModuleCxxCdb();
|
||||
virtual std::shared_ptr<IndexerBase> createIndexer();
|
||||
};
|
||||
|
||||
|
||||
@@ -4,10 +4,6 @@
|
||||
#include "data/indexer/IndexerCommandCxxManual.h"
|
||||
#include "data/parser/cxx/CxxParser.h"
|
||||
|
||||
IndexerFactoryModuleCxxManual::~IndexerFactoryModuleCxxManual()
|
||||
{
|
||||
}
|
||||
|
||||
std::shared_ptr<IndexerBase> IndexerFactoryModuleCxxManual::createIndexer()
|
||||
{
|
||||
return std::make_shared<IndexerCxx<IndexerCommandCxxManual, CxxParser>>();
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
class IndexerFactoryModuleCxxManual: public IndexerFactoryModule
|
||||
{
|
||||
public:
|
||||
virtual ~IndexerFactoryModuleCxxManual();
|
||||
virtual std::shared_ptr<IndexerBase> createIndexer();
|
||||
};
|
||||
|
||||
|
||||
@@ -1,23 +1,36 @@
|
||||
#include "data/parser/cxx/name/CxxDeclName.h"
|
||||
|
||||
CxxDeclName::CxxDeclName(std::string name, std::vector<std::string> templateParameterNames)
|
||||
: m_name(name)
|
||||
, m_templateParameterNames(templateParameterNames)
|
||||
//CxxDeclName::CxxDeclName(const std::string& name, const std::vector<std::string>& templateParameterNames)
|
||||
// : m_name(name)
|
||||
// , m_templateParameterNames(templateParameterNames)
|
||||
//{
|
||||
//}
|
||||
|
||||
CxxDeclName::CxxDeclName(std::string&& name, std::vector<std::string>&& templateParameterNames)
|
||||
: m_name(std::move(name))
|
||||
, m_templateParameterNames(std::move(templateParameterNames))
|
||||
{
|
||||
}
|
||||
|
||||
//CxxDeclName::CxxDeclName(
|
||||
// const std::string& name,
|
||||
// const std::vector<std::string>& templateParameterNames,
|
||||
// std::shared_ptr<CxxName> parent
|
||||
//)
|
||||
// : CxxName(parent)
|
||||
// , m_name(name)
|
||||
// , m_templateParameterNames(templateParameterNames)
|
||||
//{
|
||||
//}
|
||||
|
||||
CxxDeclName::CxxDeclName(
|
||||
std::string name,
|
||||
std::vector<std::string> templateParameterNames,
|
||||
std::string&& name,
|
||||
std::vector<std::string>&& templateParameterNames,
|
||||
std::shared_ptr<CxxName> parent
|
||||
)
|
||||
: CxxName(parent)
|
||||
, m_name(name)
|
||||
, m_templateParameterNames(templateParameterNames)
|
||||
{
|
||||
}
|
||||
|
||||
CxxDeclName::~CxxDeclName()
|
||||
, m_name(std::move(name))
|
||||
, m_templateParameterNames(std::move(templateParameterNames))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -11,18 +11,30 @@
|
||||
class CxxDeclName: public CxxName
|
||||
{
|
||||
public:
|
||||
CxxDeclName(
|
||||
std::string name,
|
||||
std::vector<std::string> templateParameterNames
|
||||
);
|
||||
// uncomment this constructor if required, but try to use the one using move constructors for the members
|
||||
//CxxDeclName(
|
||||
// const std::string& name,
|
||||
// const std::vector<std::string>& templateParameterNames
|
||||
//);
|
||||
|
||||
CxxDeclName(
|
||||
std::string name,
|
||||
std::vector<std::string> templateParameterNames,
|
||||
std::string&& name,
|
||||
std::vector<std::string>&& templateParameterNames
|
||||
);
|
||||
|
||||
// uncomment this constructor if required, but try to use the one using move constructors for the members
|
||||
//CxxDeclName(
|
||||
// const std::string& name,
|
||||
// const std::vector<std::string>& templateParameterNames,
|
||||
// std::shared_ptr<CxxName> parent
|
||||
//);
|
||||
|
||||
CxxDeclName(
|
||||
std::string&& name,
|
||||
std::vector<std::string>&& templateParameterNames,
|
||||
std::shared_ptr<CxxName> parent
|
||||
);
|
||||
|
||||
virtual ~CxxDeclName();
|
||||
virtual NameHierarchy toNameHierarchy() const;
|
||||
|
||||
std::string getName() const;
|
||||
|
||||
@@ -1,42 +1,71 @@
|
||||
#include "data/parser/cxx/name/CxxFunctionDeclName.h"
|
||||
|
||||
//CxxFunctionDeclName::CxxFunctionDeclName(
|
||||
// const std::string& name,
|
||||
// const std::vector<std::string>& templateParameterNames,
|
||||
// std::shared_ptr<CxxTypeName> returnTypeName,
|
||||
// const std::vector<std::shared_ptr<CxxTypeName>>& parameterTypeNames,
|
||||
// const bool isConst,
|
||||
// const bool isStatic
|
||||
//)
|
||||
// : CxxDeclName(name, templateParameterNames)
|
||||
// , m_returnTypeName(returnTypeName)
|
||||
// , m_parameterTypeNames(parameterTypeNames)
|
||||
// , m_isConst(isConst)
|
||||
// , m_isStatic(isStatic)
|
||||
//{
|
||||
//}
|
||||
|
||||
CxxFunctionDeclName::CxxFunctionDeclName(
|
||||
const std::string& name,
|
||||
const std::vector<std::string>& templateParameterNames,
|
||||
std::string&& name,
|
||||
std::vector<std::string>&& templateParameterNames,
|
||||
std::shared_ptr<CxxTypeName> returnTypeName,
|
||||
const std::vector<std::shared_ptr<CxxTypeName>>& parameterTypeNames,
|
||||
std::vector<std::shared_ptr<CxxTypeName>>&& parameterTypeNames,
|
||||
const bool isConst,
|
||||
const bool isStatic
|
||||
)
|
||||
: CxxDeclName(name, templateParameterNames)
|
||||
: CxxDeclName(std::move(name), std::move(templateParameterNames))
|
||||
, m_returnTypeName(returnTypeName)
|
||||
, m_parameterTypeNames(parameterTypeNames)
|
||||
, m_parameterTypeNames(std::move(parameterTypeNames))
|
||||
, m_isConst(isConst)
|
||||
, m_isStatic(isStatic)
|
||||
{
|
||||
}
|
||||
|
||||
//CxxFunctionDeclName::CxxFunctionDeclName(
|
||||
// const std::string& name,
|
||||
// const std::vector<std::string>& templateParameterNames,
|
||||
// std::shared_ptr<CxxTypeName> returnTypeName,
|
||||
// const std::vector<std::shared_ptr<CxxTypeName>>& parameterTypeNames,
|
||||
// const bool isConst,
|
||||
// const bool isStatic,
|
||||
// std::shared_ptr<CxxName> parent
|
||||
//)
|
||||
// : CxxDeclName(name, templateParameterNames, parent)
|
||||
// , m_returnTypeName(returnTypeName)
|
||||
// , m_parameterTypeNames(parameterTypeNames)
|
||||
// , m_isConst(isConst)
|
||||
// , m_isStatic(isStatic)
|
||||
//{
|
||||
//}
|
||||
|
||||
CxxFunctionDeclName::CxxFunctionDeclName(
|
||||
const std::string& name,
|
||||
const std::vector<std::string>& templateParameterNames,
|
||||
std::string&& name,
|
||||
std::vector<std::string>&& templateParameterNames,
|
||||
std::shared_ptr<CxxTypeName> returnTypeName,
|
||||
const std::vector<std::shared_ptr<CxxTypeName>>& parameterTypeNames,
|
||||
std::vector<std::shared_ptr<CxxTypeName>>&& parameterTypeNames,
|
||||
const bool isConst,
|
||||
const bool isStatic,
|
||||
std::shared_ptr<CxxName> parent
|
||||
)
|
||||
: CxxDeclName(name, templateParameterNames, parent)
|
||||
: CxxDeclName(std::move(name), std::move(templateParameterNames), parent)
|
||||
, m_returnTypeName(returnTypeName)
|
||||
, m_parameterTypeNames(parameterTypeNames)
|
||||
, m_parameterTypeNames(std::move(parameterTypeNames))
|
||||
, m_isConst(isConst)
|
||||
, m_isStatic(isStatic)
|
||||
{
|
||||
}
|
||||
|
||||
CxxFunctionDeclName::~CxxFunctionDeclName()
|
||||
{
|
||||
}
|
||||
|
||||
NameHierarchy CxxFunctionDeclName::toNameHierarchy() const
|
||||
{
|
||||
std::string signaturePrefix;
|
||||
|
||||
@@ -10,27 +10,46 @@
|
||||
class CxxFunctionDeclName: public CxxDeclName
|
||||
{
|
||||
public:
|
||||
// uncomment this constructor if required, but try to use the one using move constructors for the members
|
||||
//CxxFunctionDeclName(
|
||||
// const std::string& name,
|
||||
// const std::vector<std::string>& templateParameterNames,
|
||||
// std::shared_ptr<CxxTypeName> returnTypeName,
|
||||
// const std::vector<std::shared_ptr<CxxTypeName>>& parameterTypeNames,
|
||||
// const bool isConst,
|
||||
// const bool isStatic
|
||||
//);
|
||||
|
||||
CxxFunctionDeclName(
|
||||
const std::string& name,
|
||||
const std::vector<std::string>& templateParameterNames,
|
||||
std::string&& name,
|
||||
std::vector<std::string>&& templateParameterNames,
|
||||
std::shared_ptr<CxxTypeName> returnTypeName,
|
||||
const std::vector<std::shared_ptr<CxxTypeName>>& parameterTypeNames,
|
||||
std::vector<std::shared_ptr<CxxTypeName>>&& parameterTypeNames,
|
||||
const bool isConst,
|
||||
const bool isStatic
|
||||
);
|
||||
|
||||
// uncomment this constructor if required, but try to use the one using move constructors for the members
|
||||
//CxxFunctionDeclName(
|
||||
// const std::string& name,
|
||||
// const std::vector<std::string>& templateParameterNames,
|
||||
// std::shared_ptr<CxxTypeName> returnTypeName,
|
||||
// const std::vector<std::shared_ptr<CxxTypeName>>& parameterTypeNames,
|
||||
// const bool isConst,
|
||||
// const bool isStatic,
|
||||
// std::shared_ptr<CxxName> parent
|
||||
//);
|
||||
|
||||
CxxFunctionDeclName(
|
||||
const std::string& name,
|
||||
const std::vector<std::string>& templateParameterNames,
|
||||
std::string&& name,
|
||||
std::vector<std::string>&& templateParameterNames,
|
||||
std::shared_ptr<CxxTypeName> returnTypeName,
|
||||
const std::vector<std::shared_ptr<CxxTypeName>>& parameterTypeNames,
|
||||
std::vector<std::shared_ptr<CxxTypeName>>&& parameterTypeNames,
|
||||
const bool isConst,
|
||||
const bool isStatic,
|
||||
std::shared_ptr<CxxName> parent
|
||||
);
|
||||
|
||||
virtual ~CxxFunctionDeclName();
|
||||
|
||||
virtual NameHierarchy toNameHierarchy() const;
|
||||
|
||||
private:
|
||||
|
||||
@@ -9,10 +9,6 @@ CxxName::CxxName(std::shared_ptr<CxxName> parent)
|
||||
{
|
||||
}
|
||||
|
||||
CxxName::~CxxName()
|
||||
{
|
||||
}
|
||||
|
||||
void CxxName::setParent(std::shared_ptr<CxxName> parent)
|
||||
{
|
||||
m_parent = parent;
|
||||
|
||||
@@ -13,7 +13,7 @@ public:
|
||||
CxxName();
|
||||
CxxName(std::shared_ptr<CxxName> parent);
|
||||
|
||||
virtual ~CxxName();
|
||||
virtual ~CxxName() = default;
|
||||
|
||||
void setParent(std::shared_ptr<CxxName> parent);
|
||||
std::shared_ptr<CxxName> getParent() const;
|
||||
|
||||
@@ -1,31 +1,52 @@
|
||||
#include "data/parser/cxx/name/CxxStaticFunctionDeclName.h"
|
||||
|
||||
//CxxStaticFunctionDeclName::CxxStaticFunctionDeclName(
|
||||
// const std::string& name,
|
||||
// const std::vector<std::string>& templateParameterNames,
|
||||
// std::shared_ptr<CxxTypeName> returnTypeName,
|
||||
// const std::vector<std::shared_ptr<CxxTypeName>>& parameterTypeNames,
|
||||
// const std::string& translationUnitFileName
|
||||
//)
|
||||
// : CxxFunctionDeclName(name, templateParameterNames, returnTypeName, parameterTypeNames, false, true)
|
||||
// , m_translationUnitFileName(translationUnitFileName)
|
||||
//{
|
||||
//}
|
||||
|
||||
CxxStaticFunctionDeclName::CxxStaticFunctionDeclName(
|
||||
const std::string& name,
|
||||
const std::vector<std::string>& templateParameterNames,
|
||||
std::string&& name,
|
||||
std::vector<std::string>&& templateParameterNames,
|
||||
std::shared_ptr<CxxTypeName> returnTypeName,
|
||||
const std::vector<std::shared_ptr<CxxTypeName>>& parameterTypeNames,
|
||||
const std::string& translationUnitFileName
|
||||
std::vector<std::shared_ptr<CxxTypeName>>&& parameterTypeNames,
|
||||
std::string&& translationUnitFileName
|
||||
)
|
||||
: CxxFunctionDeclName(name, templateParameterNames, returnTypeName, parameterTypeNames, false, true)
|
||||
, m_translationUnitFileName(translationUnitFileName)
|
||||
: CxxFunctionDeclName(std::move(name), std::move(templateParameterNames), returnTypeName, std::move(parameterTypeNames), false, true)
|
||||
, m_translationUnitFileName(std::move(translationUnitFileName))
|
||||
{
|
||||
}
|
||||
|
||||
//CxxStaticFunctionDeclName::CxxStaticFunctionDeclName(
|
||||
// const std::string& name,
|
||||
// const std::vector<std::string>& templateParameterNames,
|
||||
// std::shared_ptr<CxxTypeName> returnTypeName,
|
||||
// const std::vector<std::shared_ptr<CxxTypeName>>& parameterTypeNames,
|
||||
// const std::string& translationUnitFileName,
|
||||
// std::shared_ptr<CxxName> parent
|
||||
//)
|
||||
// : CxxFunctionDeclName(name, templateParameterNames, returnTypeName, parameterTypeNames, false, true, parent)
|
||||
// , m_translationUnitFileName(translationUnitFileName)
|
||||
//{
|
||||
//}
|
||||
|
||||
CxxStaticFunctionDeclName::CxxStaticFunctionDeclName(
|
||||
const std::string& name,
|
||||
const std::vector<std::string>& templateParameterNames,
|
||||
std::string&& name,
|
||||
std::vector<std::string>&& templateParameterNames,
|
||||
std::shared_ptr<CxxTypeName> returnTypeName,
|
||||
const std::vector<std::shared_ptr<CxxTypeName>>& parameterTypeNames,
|
||||
const std::string& translationUnitFileName,
|
||||
std::vector<std::shared_ptr<CxxTypeName>>&& parameterTypeNames,
|
||||
std::string&& translationUnitFileName,
|
||||
std::shared_ptr<CxxName> parent
|
||||
)
|
||||
: CxxFunctionDeclName(name, templateParameterNames, returnTypeName, parameterTypeNames, false, true, parent)
|
||||
, m_translationUnitFileName(translationUnitFileName)
|
||||
{
|
||||
}
|
||||
|
||||
CxxStaticFunctionDeclName::~CxxStaticFunctionDeclName()
|
||||
: CxxFunctionDeclName(std::move(name), std::move(templateParameterNames), returnTypeName, std::move(parameterTypeNames), false, true, parent)
|
||||
, m_translationUnitFileName(std::move(translationUnitFileName))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -6,25 +6,42 @@
|
||||
class CxxStaticFunctionDeclName: public CxxFunctionDeclName
|
||||
{
|
||||
public:
|
||||
CxxStaticFunctionDeclName(
|
||||
const std::string& name,
|
||||
const std::vector<std::string>& templateParameterNames,
|
||||
std::shared_ptr<CxxTypeName> returnTypeName,
|
||||
const std::vector<std::shared_ptr<CxxTypeName>>& parameterTypeNames,
|
||||
const std::string& translationUnitFileName
|
||||
);
|
||||
// uncomment this constructor if required, but try to use the one using move constructors for the members
|
||||
//CxxStaticFunctionDeclName(
|
||||
// const std::string& name,
|
||||
// const std::vector<std::string>& templateParameterNames,
|
||||
// std::shared_ptr<CxxTypeName> returnTypeName,
|
||||
// const std::vector<std::shared_ptr<CxxTypeName>>& parameterTypeNames,
|
||||
// const std::string& translationUnitFileName
|
||||
//);
|
||||
|
||||
CxxStaticFunctionDeclName(
|
||||
const std::string& name,
|
||||
const std::vector<std::string>& templateParameterNames,
|
||||
std::string&& name,
|
||||
std::vector<std::string>&& templateParameterNames,
|
||||
std::shared_ptr<CxxTypeName> returnTypeName,
|
||||
const std::vector<std::shared_ptr<CxxTypeName>>& parameterTypeNames,
|
||||
const std::string& translationUnitFileName,
|
||||
std::vector<std::shared_ptr<CxxTypeName>>&& parameterTypeNames,
|
||||
std::string&& translationUnitFileName
|
||||
);
|
||||
|
||||
// uncomment this constructor if required, but try to use the one using move constructors for the members
|
||||
//CxxStaticFunctionDeclName(
|
||||
// const std::string& name,
|
||||
// const std::vector<std::string>& templateParameterNames,
|
||||
// std::shared_ptr<CxxTypeName> returnTypeName,
|
||||
// const std::vector<std::shared_ptr<CxxTypeName>>& parameterTypeNames,
|
||||
// const std::string& translationUnitFileName,
|
||||
// std::shared_ptr<CxxName> parent
|
||||
//);
|
||||
|
||||
CxxStaticFunctionDeclName(
|
||||
std::string&& name,
|
||||
std::vector<std::string>&& templateParameterNames,
|
||||
std::shared_ptr<CxxTypeName> returnTypeName,
|
||||
std::vector<std::shared_ptr<CxxTypeName>>&& parameterTypeNames,
|
||||
std::string&& translationUnitFileName,
|
||||
std::shared_ptr<CxxName> parent
|
||||
);
|
||||
|
||||
virtual ~CxxStaticFunctionDeclName();
|
||||
|
||||
virtual NameHierarchy toNameHierarchy() const;
|
||||
|
||||
private:
|
||||
|
||||
@@ -11,29 +11,42 @@ std::shared_ptr<CxxTypeName> CxxTypeName::makeUnsolvedIfNull(std::shared_ptr<Cxx
|
||||
);
|
||||
}
|
||||
|
||||
CxxTypeName::Modifier::Modifier(std::string symbol)
|
||||
: symbol(symbol)
|
||||
CxxTypeName::Modifier::Modifier(std::string&& symbol)
|
||||
: symbol(std::move(symbol))
|
||||
{
|
||||
}
|
||||
|
||||
CxxTypeName::CxxTypeName(std::string name, std::vector<std::string> templateArguments)
|
||||
: m_name(name)
|
||||
, m_templateArguments(templateArguments)
|
||||
//CxxTypeName::CxxTypeName(const std::string& name, const std::vector<std::string>& templateArguments)
|
||||
// : m_name(name)
|
||||
// , m_templateArguments(templateArguments)
|
||||
//{
|
||||
//}
|
||||
|
||||
CxxTypeName::CxxTypeName(std::string&& name, std::vector<std::string>&& templateArguments)
|
||||
: m_name(std::move(name))
|
||||
, m_templateArguments(std::move(templateArguments))
|
||||
{
|
||||
}
|
||||
|
||||
//CxxTypeName::CxxTypeName(
|
||||
// const std::string& name,
|
||||
// const std::vector<std::string>& templateArguments,
|
||||
// std::shared_ptr<CxxName> parent
|
||||
//)
|
||||
// : CxxName(parent)
|
||||
// , m_name(name)
|
||||
// , m_templateArguments(templateArguments)
|
||||
//{
|
||||
//}
|
||||
|
||||
CxxTypeName::CxxTypeName(
|
||||
std::string name,
|
||||
std::vector<std::string> templateArguments,
|
||||
std::string&& name,
|
||||
std::vector<std::string>&& templateArguments,
|
||||
std::shared_ptr<CxxName> parent
|
||||
)
|
||||
: CxxName(parent)
|
||||
, m_name(name)
|
||||
, m_templateArguments(templateArguments)
|
||||
{
|
||||
}
|
||||
|
||||
CxxTypeName::~CxxTypeName()
|
||||
, m_name(std::move(name))
|
||||
, m_templateArguments(std::move(templateArguments))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -16,23 +16,35 @@ public:
|
||||
|
||||
struct Modifier
|
||||
{
|
||||
Modifier(std::string symbol);
|
||||
Modifier(std::string&& symbol);
|
||||
std::string symbol;
|
||||
CxxQualifierFlags qualifierFlags;
|
||||
};
|
||||
|
||||
CxxTypeName(
|
||||
std::string name,
|
||||
std::vector<std::string> templateArguments
|
||||
);
|
||||
// uncomment this constructor if required, but try to use the one using move constructors for the members
|
||||
//CxxTypeName(
|
||||
// const std::string& name,
|
||||
// const std::vector<std::string>& templateArguments
|
||||
//);
|
||||
|
||||
CxxTypeName(
|
||||
std::string name,
|
||||
std::vector<std::string> templateArguments,
|
||||
std::string&& name,
|
||||
std::vector<std::string>&& templateArguments
|
||||
);
|
||||
|
||||
// uncomment this constructor if required, but try to use the one using move constructors for the members
|
||||
//CxxTypeName(
|
||||
// const std::string& name,
|
||||
// const std::vector<std::string>& templateArguments,
|
||||
// std::shared_ptr<CxxName> parent
|
||||
//);
|
||||
|
||||
CxxTypeName(
|
||||
std::string&& name,
|
||||
std::vector<std::string>&& templateArguments,
|
||||
std::shared_ptr<CxxName> parent
|
||||
);
|
||||
|
||||
virtual ~CxxTypeName();
|
||||
virtual NameHierarchy toNameHierarchy() const;
|
||||
|
||||
void addQualifier(const CxxQualifierFlags::QualifierType qualifier);
|
||||
|
||||
@@ -1,34 +1,55 @@
|
||||
#include "data/parser/cxx/name/CxxVariableDeclName.h"
|
||||
|
||||
//CxxVariableDeclName::CxxVariableDeclName(
|
||||
// const std::string& name,
|
||||
// const std::vector<std::string>& templateParameterNames,
|
||||
// std::shared_ptr<CxxTypeName> typeName,
|
||||
// bool isStatic
|
||||
//)
|
||||
// : CxxDeclName(name, templateParameterNames)
|
||||
// , m_typeName(typeName)
|
||||
// , m_isStatic(isStatic)
|
||||
//{
|
||||
//}
|
||||
|
||||
CxxVariableDeclName::CxxVariableDeclName(
|
||||
std::string name,
|
||||
std::vector<std::string> templateParameterNames,
|
||||
std::string&& name,
|
||||
std::vector<std::string>&& templateParameterNames,
|
||||
std::shared_ptr<CxxTypeName> typeName,
|
||||
bool isStatic
|
||||
)
|
||||
: CxxDeclName(name, templateParameterNames)
|
||||
: CxxDeclName(std::move(name), std::move(templateParameterNames))
|
||||
, m_typeName(typeName)
|
||||
, m_isStatic(isStatic)
|
||||
{
|
||||
}
|
||||
|
||||
//CxxVariableDeclName::CxxVariableDeclName(
|
||||
// const std::string& name,
|
||||
// const std::vector<std::string>& templateParameterNames,
|
||||
// std::shared_ptr<CxxTypeName> typeName,
|
||||
// bool isStatic,
|
||||
// std::shared_ptr<CxxName> parent
|
||||
//)
|
||||
// : CxxDeclName(name, templateParameterNames, parent)
|
||||
// , m_typeName(typeName)
|
||||
// , m_isStatic(isStatic)
|
||||
//{
|
||||
//}
|
||||
|
||||
CxxVariableDeclName::CxxVariableDeclName(
|
||||
std::string name,
|
||||
std::vector<std::string> templateParameterNames,
|
||||
std::string&& name,
|
||||
std::vector<std::string>&& templateParameterNames,
|
||||
std::shared_ptr<CxxTypeName> typeName,
|
||||
bool isStatic,
|
||||
std::shared_ptr<CxxName> parent
|
||||
)
|
||||
: CxxDeclName(name, templateParameterNames, parent)
|
||||
: CxxDeclName(std::move(name), std::move(templateParameterNames), parent)
|
||||
, m_typeName(typeName)
|
||||
, m_isStatic(isStatic)
|
||||
{
|
||||
}
|
||||
|
||||
CxxVariableDeclName::~CxxVariableDeclName()
|
||||
{
|
||||
}
|
||||
|
||||
NameHierarchy CxxVariableDeclName::toNameHierarchy() const
|
||||
{
|
||||
std::string signaturePrefix;
|
||||
|
||||
@@ -10,23 +10,38 @@
|
||||
class CxxVariableDeclName: public CxxDeclName
|
||||
{
|
||||
public:
|
||||
// uncomment this constructor if required, but try to use the one using move constructors for the members
|
||||
//CxxVariableDeclName(
|
||||
// const std::string& name,
|
||||
// const std::vector<std::string>& templateParameterNames,
|
||||
// std::shared_ptr<CxxTypeName> typeName,
|
||||
// bool isStatic
|
||||
//);
|
||||
|
||||
CxxVariableDeclName(
|
||||
std::string name,
|
||||
std::vector<std::string> templateParameterNames,
|
||||
std::string&& name,
|
||||
std::vector<std::string>&& templateParameterNames,
|
||||
std::shared_ptr<CxxTypeName> typeName,
|
||||
bool isStatic
|
||||
);
|
||||
|
||||
// uncomment this constructor if required, but try to use the one using move constructors for the members
|
||||
//CxxVariableDeclName(
|
||||
// const std::string& name,
|
||||
// const std::vector<std::string>& templateParameterNames,
|
||||
// std::shared_ptr<CxxTypeName> typeName,
|
||||
// bool isStatic,
|
||||
// std::shared_ptr<CxxName> parent
|
||||
//);
|
||||
|
||||
CxxVariableDeclName(
|
||||
std::string name,
|
||||
std::vector<std::string> templateParameterNames,
|
||||
std::string&& name,
|
||||
std::vector<std::string>&& templateParameterNames,
|
||||
std::shared_ptr<CxxTypeName> typeName,
|
||||
bool isStatic,
|
||||
std::shared_ptr<CxxName> parent
|
||||
);
|
||||
|
||||
virtual ~CxxVariableDeclName();
|
||||
|
||||
virtual NameHierarchy toNameHierarchy() const;
|
||||
|
||||
private:
|
||||
|
||||
@@ -217,10 +217,12 @@ std::shared_ptr<CxxDeclName> CxxDeclNameResolver::getDeclName(const clang::Named
|
||||
}
|
||||
else if (clang::isa<clang::ClassTemplatePartialSpecializationDecl>(declaration))
|
||||
{
|
||||
const std::vector<std::string> templateParameterNames = getTemplateParameterStringsOfPatrialSpecialitarion(
|
||||
clang::dyn_cast<clang::ClassTemplatePartialSpecializationDecl>(declaration)
|
||||
return std::make_shared<CxxDeclName>(
|
||||
std::move(declNameString),
|
||||
getTemplateParameterStringsOfPatrialSpecialitarion(
|
||||
clang::dyn_cast<clang::ClassTemplatePartialSpecializationDecl>(declaration)
|
||||
)
|
||||
);
|
||||
return std::make_shared<CxxDeclName>(declNameString, templateParameterNames);
|
||||
}
|
||||
else if (clang::isa<clang::ClassTemplateSpecializationDecl>(declaration))
|
||||
{
|
||||
@@ -230,7 +232,7 @@ std::shared_ptr<CxxDeclName> CxxDeclNameResolver::getDeclName(const clang::Named
|
||||
{
|
||||
templateArguments.push_back(getTemplateArgumentName(templateArgumentList.get(i)));
|
||||
}
|
||||
return std::make_shared<CxxDeclName>(declNameString, templateArguments);
|
||||
return std::make_shared<CxxDeclName>(std::move(declNameString), std::move(templateArguments));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -289,19 +291,19 @@ std::shared_ptr<CxxDeclName> CxxDeclNameResolver::getDeclName(const clang::Named
|
||||
if (!clang::isa<clang::CXXMethodDecl>(declaration) && isStatic)
|
||||
{
|
||||
return std::make_shared<CxxStaticFunctionDeclName>(
|
||||
functionName,
|
||||
templateArguments,
|
||||
std::move(functionName),
|
||||
std::move(templateArguments),
|
||||
returnTypeName,
|
||||
parameterTypeNames,
|
||||
std::move(parameterTypeNames),
|
||||
getTranslationUnitMainFileName(declaration)
|
||||
);
|
||||
}
|
||||
|
||||
return std::make_shared<CxxFunctionDeclName>(
|
||||
functionName,
|
||||
templateArguments,
|
||||
std::move(functionName),
|
||||
std::move(templateArguments),
|
||||
returnTypeName,
|
||||
parameterTypeNames,
|
||||
std::move(parameterTypeNames),
|
||||
isConst,
|
||||
isStatic
|
||||
);
|
||||
@@ -317,7 +319,7 @@ std::shared_ptr<CxxDeclName> CxxDeclNameResolver::getDeclName(const clang::Named
|
||||
CxxTypeNameResolver typenNameResolver(getCanonicalFilePathCache(), getIgnoredContextDecls());
|
||||
typenNameResolver.ignoreContextDecl(fieldDecl);
|
||||
std::shared_ptr<CxxTypeName> typeName = CxxTypeName::makeUnsolvedIfNull(typenNameResolver.getName(fieldDecl->getType()));
|
||||
return std::make_shared<CxxVariableDeclName>(declNameString, std::vector<std::string>(), typeName, false);
|
||||
return std::make_shared<CxxVariableDeclName>(std::move(declNameString), std::vector<std::string>(), typeName, false);
|
||||
}
|
||||
else if (clang::isa<clang::NamespaceDecl>(declaration) && clang::dyn_cast<clang::NamespaceDecl>(declaration)->isAnonymousNamespace())
|
||||
{
|
||||
@@ -406,7 +408,7 @@ std::shared_ptr<CxxDeclName> CxxDeclNameResolver::getDeclName(const clang::Named
|
||||
}
|
||||
}
|
||||
|
||||
return std::make_shared<CxxVariableDeclName>(varName, templateParameterNames, typeName, isStatic);
|
||||
return std::make_shared<CxxVariableDeclName>(std::move(varName), std::move(templateParameterNames), typeName, isStatic);
|
||||
}
|
||||
}
|
||||
else if (clang::isa<clang::VarTemplateDecl>(declaration))
|
||||
@@ -416,12 +418,12 @@ std::shared_ptr<CxxDeclName> CxxDeclNameResolver::getDeclName(const clang::Named
|
||||
}
|
||||
else if (clang::isa<clang::TemplateDecl>(declaration)) // also triggers on TemplateTemplateParmDecl
|
||||
{
|
||||
return std::make_shared<CxxDeclName>(declNameString, getTemplateParameterStrings(clang::dyn_cast<clang::TemplateDecl>(declaration)));
|
||||
return std::make_shared<CxxDeclName>(std::move(declNameString), getTemplateParameterStrings(clang::dyn_cast<clang::TemplateDecl>(declaration)));
|
||||
}
|
||||
|
||||
if (!declNameString.empty())
|
||||
{
|
||||
return std::make_shared<CxxDeclName>(declNameString, std::vector<std::string>(), std::shared_ptr<CxxName>());
|
||||
return std::make_shared<CxxDeclName>(std::move(declNameString), std::vector<std::string>(), std::shared_ptr<CxxName>());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -178,7 +178,7 @@ std::shared_ptr<CxxTypeName> CxxTypeNameResolver::getName(const clang::Type* typ
|
||||
|
||||
typeName = std::make_shared<CxxTypeName>(
|
||||
declName->getName(),
|
||||
templateArguments,
|
||||
std::move(templateArguments),
|
||||
declName->getParent()
|
||||
);
|
||||
}
|
||||
@@ -235,7 +235,7 @@ std::shared_ptr<CxxTypeName> CxxTypeNameResolver::getName(const clang::Type* typ
|
||||
}
|
||||
|
||||
typeName = std::make_shared<CxxTypeName>(
|
||||
dependentType->getIdentifier()->getName().str(), templateArguments, specifierName
|
||||
dependentType->getIdentifier()->getName().str(), std::move(templateArguments), specifierName
|
||||
);
|
||||
break;
|
||||
}
|
||||
@@ -280,7 +280,7 @@ std::shared_ptr<CxxTypeName> CxxTypeNameResolver::getName(const clang::Type* typ
|
||||
nameString += ")";
|
||||
|
||||
typeName = std::make_shared<CxxTypeName>(
|
||||
nameString, std::vector<std::string>()
|
||||
std::move(nameString), std::vector<std::string>()
|
||||
);
|
||||
break;
|
||||
}
|
||||
@@ -304,7 +304,7 @@ std::shared_ptr<CxxTypeName> CxxTypeNameResolver::getName(const clang::Type* typ
|
||||
std::string nameString = StrOS.str();
|
||||
|
||||
typeName = std::make_shared<CxxTypeName>(
|
||||
nameString, std::vector<std::string>()
|
||||
std::move(nameString), std::vector<std::string>()
|
||||
);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ void JavaEnvironmentFactory::createInstance(std::string classPath, std::string&
|
||||
errorString
|
||||
);
|
||||
|
||||
if (!createInstanceFunction && errorString.size() > 0)
|
||||
if (!createInstanceFunction && !errorString.empty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ JavaParser::JavaParser(std::shared_ptr<ParserClient> client, std::shared_ptr<Fil
|
||||
, m_id(s_nextParserId++)
|
||||
{
|
||||
const std::string errorString = utility::prepareJavaEnvironment();
|
||||
if (errorString.size() > 0)
|
||||
if (!errorString.empty())
|
||||
{
|
||||
LOG_ERROR(errorString);
|
||||
}
|
||||
|
||||
@@ -191,7 +191,7 @@ private:
|
||||
jint jAccess, jint jDefinitionKind
|
||||
);
|
||||
|
||||
void doRecordReference(jint jRefType, jstring jReferencedName, jstring jContextName, jint beginLine, jint beginColumn, jint endLine, jint endColumn);
|
||||
void doRecordReference(jint jReferenceKind, jstring jReferencedName, jstring jContextName, jint beginLine, jint beginColumn, jint endLine, jint endColumn);
|
||||
void doRecordQualifierLocation(jstring jQualifierName, jint beginLine, jint beginColumn, jint endLine, jint endColumn);
|
||||
void doRecordLocalSymbol(jstring jSymbolName, jint beginLine, jint beginColumn, jint endLine, jint endColumn);
|
||||
void doRecordComment(jint beginLine, jint beginColumn, jint endLine, jint endColumn);
|
||||
|
||||
+27
-27
@@ -189,25 +189,25 @@ std::string License::getLicenseInfo() const
|
||||
info += m_type + "\n";
|
||||
info += getExpireLine() + "\n";
|
||||
|
||||
// get info depending on license type
|
||||
// get info depending on license type
|
||||
if (isNonCommercialLicenseType())
|
||||
{
|
||||
info += "not registered for commercial development";
|
||||
}
|
||||
{
|
||||
info += "not registered for commercial development";
|
||||
}
|
||||
else if (m_type == LicenseConstants::TEST_LICENSE_STRING)
|
||||
{
|
||||
info += "unlimited Seats";
|
||||
}
|
||||
{
|
||||
info += "unlimited Seats";
|
||||
}
|
||||
else if (m_seats > 1)
|
||||
{
|
||||
{
|
||||
info += std::to_string(m_seats) + " Seats";
|
||||
}
|
||||
else
|
||||
{
|
||||
info += "1 Seat";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
info += "1 Seat";
|
||||
}
|
||||
|
||||
return info;
|
||||
return info;
|
||||
}
|
||||
|
||||
std::string License::getUser() const
|
||||
@@ -355,7 +355,7 @@ bool License::isValid() const
|
||||
}
|
||||
try
|
||||
{
|
||||
if (m_signature.size() <= 0)
|
||||
if (m_signature.empty())
|
||||
{
|
||||
std::cout << "Could not read signature" << std::endl;
|
||||
return false;
|
||||
@@ -395,14 +395,14 @@ bool License::isValid() const
|
||||
bool License::isExpired() const
|
||||
{
|
||||
if ( getType() == LicenseConstants::TEST_LICENSE_STRING)
|
||||
{
|
||||
return (getTimeLeft()==-1);
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
return (getTimeLeft()==-1);
|
||||
}
|
||||
else
|
||||
{
|
||||
Version version = Version::fromString(m_expire);
|
||||
return Version::getApplicationVersion() > version;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::string License::getPublicKeyFilename() const
|
||||
@@ -423,7 +423,7 @@ bool License::loadPublicKeyFromFile(const std::string& filename)
|
||||
|
||||
if(boost::filesystem::exists(getPublicKeyFilename()))
|
||||
{
|
||||
Botan::RSA_PublicKey *rsaPublicKey = dynamic_cast<Botan::RSA_PublicKey *>(Botan::X509::load_key(getPublicKeyFilename()));
|
||||
Botan::RSA_PublicKey* rsaPublicKey = dynamic_cast<Botan::RSA_PublicKey *>(Botan::X509::load_key(getPublicKeyFilename()));
|
||||
|
||||
if (!rsaPublicKey)
|
||||
{
|
||||
@@ -499,7 +499,7 @@ std::string License::hashLocation(const std::string& location) const
|
||||
|
||||
bool License::checkLocation(const std::string& location, const std::string& hash)
|
||||
{
|
||||
if (!location.size() || !hash.size())
|
||||
if (location.empty() || hash.empty())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -509,7 +509,7 @@ bool License::checkLocation(const std::string& location, const std::string& hash
|
||||
|
||||
std::string License::getLicenseEncodedString(const std::string& applicationLocation) const
|
||||
{
|
||||
if (applicationLocation.size() <= 0)
|
||||
if (applicationLocation.empty())
|
||||
{
|
||||
std::cout << "No application location was given" << std::endl;
|
||||
return "";
|
||||
@@ -555,13 +555,13 @@ std::string License::getLicenseEncodedString(const std::string& applicationLocat
|
||||
|
||||
bool License::loadFromEncodedString(const std::string& encodedLicense, const std::string& applicationLocation)
|
||||
{
|
||||
if (encodedLicense.size() <= 0)
|
||||
if (encodedLicense.empty())
|
||||
{
|
||||
std::cout << "No license string given" << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (applicationLocation.size() <= 0)
|
||||
if (applicationLocation.empty())
|
||||
{
|
||||
std::cout << "No application location given" << std::endl;
|
||||
return false;
|
||||
@@ -593,7 +593,7 @@ std::string License::getHashedLicense() const
|
||||
|
||||
std::string License::getEncodeKey(const std::string applicationLocation) const
|
||||
{
|
||||
if (applicationLocation.size() <= 0)
|
||||
if (applicationLocation.empty())
|
||||
{
|
||||
std::cout << "No application location given" << std::endl;
|
||||
return "";
|
||||
|
||||
@@ -105,7 +105,7 @@ public:
|
||||
|
||||
private:
|
||||
std::string getEncodeKey(const std::string applicationLocation) const;
|
||||
bool extractData(const std::string& string, LICENSE_LINE line);
|
||||
bool extractData(const std::string& data, LICENSE_LINE line);
|
||||
std::string removeCaption(const std::string& line, const std::string& caption) const;
|
||||
|
||||
std::string m_publicKeyFilename;
|
||||
|
||||
@@ -33,7 +33,7 @@ Version Version::fromString(const std::string& versionString)
|
||||
Version version;
|
||||
std::vector<std::string> parts = split<std::vector<std::string>>(versionString, ".");
|
||||
|
||||
if (parts.size())
|
||||
if (!parts.empty())
|
||||
{
|
||||
version.m_year = std::stoi(parts[0]);
|
||||
}
|
||||
@@ -46,7 +46,7 @@ Version Version::fromString(const std::string& versionString)
|
||||
if (parts.size() > 2)
|
||||
{
|
||||
std::vector<std::string> hashParts = split<std::vector<std::string>>(parts[2], "-");
|
||||
if (hashParts.size())
|
||||
if (!hashParts.empty())
|
||||
{
|
||||
version.m_commitNumber = std::stoi(hashParts[0]);
|
||||
}
|
||||
@@ -92,12 +92,7 @@ bool Version::isEmpty() const
|
||||
|
||||
bool Version::isValid() const
|
||||
{
|
||||
if (m_minorNumber < 5 && m_minorNumber > 0
|
||||
&& m_year > 2016)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return (0 < m_minorNumber && m_minorNumber < 5 && m_year > 2016);
|
||||
}
|
||||
|
||||
std::string Version::toShortString() const
|
||||
|
||||
Reference in New Issue
Block a user