Skip to content

Commit

Permalink
Issue Framstag#1045 - Update projection
Browse files Browse the repository at this point in the history
- Fix Sonar warnings
  • Loading branch information
Framstag authored and DerKleinePunk committed Jul 16, 2023
1 parent 5f16839 commit 9610392
Showing 1 changed file with 45 additions and 32 deletions.
77 changes: 45 additions & 32 deletions libosmscout/include/osmscout/ObjectRef.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,36 @@ namespace osmscout {
public:
ObjectOSMRef() = default;
ObjectOSMRef(const ObjectOSMRef& ref) = default;
ObjectOSMRef(ObjectOSMRef&& ref) = default;

ObjectOSMRef(OSMId id,
OSMRefType type)
OSMRefType type)
: id(id),
type(type)
{
// no code
}

~ObjectOSMRef() = default;

ObjectOSMRef& operator=(const ObjectOSMRef& other) = default;
ObjectOSMRef& operator=(ObjectOSMRef&& other) = default;

bool operator<(const ObjectOSMRef& reference) const
{
return std::tie(type, id) < std::tie(reference.type, reference.id);
}

bool operator==(const ObjectOSMRef& reference) const
{
return type==reference.type && id==reference.id;
}

bool operator!=(const ObjectOSMRef& reference) const
{
return type!=reference.type || id!=reference.id;
}

void Set(const OSMId& id,
const OSMRefType& type)
{
Expand Down Expand Up @@ -110,20 +131,6 @@ namespace osmscout {
{
return type==osmRefRelation;
}
bool operator<(const ObjectOSMRef& reference) const
{
return std::tie(type, id) < std::tie(reference.type, reference.id);
}

bool operator==(const ObjectOSMRef& reference) const
{
return type==reference.type && id==reference.id;
}

bool operator!=(const ObjectOSMRef& reference) const
{
return type!=reference.type || id!=reference.id;
}

const char* GetTypeName() const;
};
Expand All @@ -149,17 +156,38 @@ namespace osmscout {
public:
ObjectFileRef() = default;
ObjectFileRef(const ObjectFileRef& ref) = default;
ObjectFileRef(ObjectFileRef&& ref) = default;

ObjectFileRef(FileOffset offset,
RefType type)
RefType type)
: offset(offset),
type(type)
{
// no code
}

~ObjectFileRef() = default;

ObjectFileRef& operator=(const ObjectFileRef& other) = default;
ObjectFileRef& operator=(ObjectFileRef&& other) = default;

bool operator<(const ObjectFileRef& reference) const
{
return std::tie(type, offset) < std::tie(reference.type, reference.offset);
}

bool operator==(const ObjectFileRef& reference) const
{
return type==reference.type && offset==reference.offset;
}

bool operator!=(const ObjectFileRef& reference) const
{
return type!=reference.type || offset!=reference.offset;
}

void Set(const FileOffset& offset,
const RefType& type)
const RefType& type)
{
this->offset=offset;
this->type=type;
Expand Down Expand Up @@ -208,21 +236,6 @@ namespace osmscout {
return type==refArea;
}

bool operator<(const ObjectFileRef& reference) const
{
return std::tie(type, offset) < std::tie(reference.type, reference.offset);
}

bool operator==(const ObjectFileRef& reference) const
{
return type==reference.type && offset==reference.offset;
}

bool operator!=(const ObjectFileRef& reference) const
{
return type!=reference.type || offset!=reference.offset;
}

const char* GetTypeName() const;
};

Expand Down

0 comments on commit 9610392

Please sign in to comment.