src: Refactored TokenLocation classes to SourceLocation classes
* Removed TokenLocationLine * decoupled TokenLocationFile from TokenLocationCollection * save vector of Token ids to SourceLocation * refactored SourceLocationFile::getFilteredByLines() * refactored snippet creation
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
#ifndef MESSAGE_ACTIVATE_SOURCE_LOCATIONS_H
|
||||
#define MESSAGE_ACTIVATE_SOURCE_LOCATIONS_H
|
||||
|
||||
#include "utility/messaging/Message.h"
|
||||
#include "utility/types.h"
|
||||
|
||||
class MessageActivateSourceLocations
|
||||
: public Message<MessageActivateSourceLocations>
|
||||
{
|
||||
public:
|
||||
MessageActivateSourceLocations(const std::vector<Id>& locationIds)
|
||||
: locationIds(locationIds)
|
||||
{
|
||||
}
|
||||
|
||||
static const std::string getStaticType()
|
||||
{
|
||||
return "MessageActivateSourceLocations";
|
||||
}
|
||||
|
||||
virtual void print(std::ostream& os) const
|
||||
{
|
||||
for (const Id& id : locationIds)
|
||||
{
|
||||
os << id << " ";
|
||||
}
|
||||
}
|
||||
|
||||
const std::vector<Id> locationIds;
|
||||
};
|
||||
|
||||
#endif // MESSAGE_ACTIVATE_SOURCE_LOCATIONS_H
|
||||
@@ -1,32 +0,0 @@
|
||||
#ifndef MESSAGE_ACTIVATE_TOKEN_LOCATIONS_H
|
||||
#define MESSAGE_ACTIVATE_TOKEN_LOCATIONS_H
|
||||
|
||||
#include "utility/messaging/Message.h"
|
||||
#include "utility/types.h"
|
||||
|
||||
class MessageActivateTokenLocations
|
||||
: public Message<MessageActivateTokenLocations>
|
||||
{
|
||||
public:
|
||||
MessageActivateTokenLocations(const std::vector<Id>& locationIds)
|
||||
: locationIds(locationIds)
|
||||
{
|
||||
}
|
||||
|
||||
static const std::string getStaticType()
|
||||
{
|
||||
return "MessageActivateTokenLocations";
|
||||
}
|
||||
|
||||
virtual void print(std::ostream& os) const
|
||||
{
|
||||
for (const Id& id : locationIds)
|
||||
{
|
||||
os << id << " ";
|
||||
}
|
||||
}
|
||||
|
||||
const std::vector<Id> locationIds;
|
||||
};
|
||||
|
||||
#endif // MESSAGE_ACTIVATE_TOKEN_LOCATIONS_H
|
||||
@@ -84,6 +84,14 @@ namespace utility
|
||||
return false;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
bool shareElement(const std::set<T>& a, const std::set<T>& b)
|
||||
{
|
||||
std::set<T> c(a.begin(), a.end());
|
||||
c.insert(b.begin(), b.end());
|
||||
return a.size() + b.size() != c.size();
|
||||
}
|
||||
|
||||
bool intersectionPoint(Vec2f a1, Vec2f b1, Vec2f a2, Vec2f b2, Vec2f* i);
|
||||
|
||||
size_t digits(size_t n);
|
||||
|
||||
Reference in New Issue
Block a user