Make Selection variables private again
parent
f8fcc4c0ae
commit
99b0acf556
|
@ -11,7 +11,7 @@ public:
|
|||
{
|
||||
size_t operator()(const Selection &s) const
|
||||
{
|
||||
return (size_t)s.obj;
|
||||
return (size_t)s.catEntry();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -23,7 +23,8 @@ class DeepSkyObject;
|
|||
class Selection
|
||||
{
|
||||
public:
|
||||
enum Type {
|
||||
enum Type
|
||||
{
|
||||
Type_Nil,
|
||||
Type_Star,
|
||||
Type_Body,
|
||||
|
@ -32,15 +33,14 @@ class Selection
|
|||
Type_Generic
|
||||
};
|
||||
|
||||
public:
|
||||
Selection() : type(Type_Nil), obj(nullptr) {};
|
||||
Selection() = default;
|
||||
Selection(CatEntry *cat) : type(Type_Generic), obj(cat) { checkNull(); };
|
||||
Selection(Star* star) : type(Type_Star), obj(star) { checkNull(); };
|
||||
Selection(Body* body) : type(Type_Body), obj(body) { checkNull(); };
|
||||
Selection(DeepSkyObject* deepsky) : type(Type_DeepSky), obj(deepsky) {checkNull(); };
|
||||
Selection(Location* location) : type(Type_Location), obj(location) { checkNull(); };
|
||||
Selection(const Selection& sel) : type(sel.type), obj(sel.obj) {};
|
||||
~Selection() {};
|
||||
~Selection() = default;
|
||||
|
||||
bool empty() const { return type == Type_Nil; }
|
||||
double radius() const;
|
||||
|
@ -78,11 +78,14 @@ public:
|
|||
|
||||
Type getType() const { return type; }
|
||||
|
||||
// private:
|
||||
Type type;
|
||||
void* obj;
|
||||
private:
|
||||
Type type { Type_Nil };
|
||||
void* obj { nullptr };
|
||||
|
||||
void checkNull() { if (obj == nullptr) type = Type_Nil; }
|
||||
|
||||
friend bool operator==(const Selection& s0, const Selection& s1);
|
||||
friend bool operator!=(const Selection& s0, const Selection& s1);
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue