AnyCAD C++ API  2018
 全部  命名空间 文件 函数 变量 类型定义 枚举 枚举值 友元 宏定义 
APIElementId.h
浏览该文件的文档.
1 #ifndef _APIElementId_H_
2 #define _APIElementId_H_
3 
4 #include <map>
5 #include <set>
6 #include <list>
7 #include <vector>
8 namespace AnyCAD{ namespace API
9 {
17  {
18  public:
19  explicit ElementId(int id);
20  ElementId();
21 
22  static const ElementId InvalidId;
23 
24  int AsInt() const {return m_Value;}
25 
26  bool IsValid() const;
27 
28  bool operator<(const ElementId& other) const { return m_Value < other.m_Value;}
29  bool operator>(const ElementId& other) const { return m_Value > other.m_Value;}
30  bool operator==(const ElementId& other) const { return m_Value == other.m_Value;}
31  bool operator!=(const ElementId& other) const { return m_Value != other.m_Value;}
32  bool operator>=(const ElementId& other) const { return m_Value >= other.m_Value;}
33  bool operator<=(const ElementId& other) const { return m_Value <= other.m_Value;}
34  ElementId& operator++(){ ++m_Value; return *this;}
35 
36  friend std::istream& operator >>(std::istream& is, ElementId& id);
37  private:
38  int m_Value;
39  };
40 
41  inline std::ostream& operator << ( std::ostream& os, const ElementId& id)
42  {
43  os << id.AsInt();
44  return os;
45  }
46  inline std::istream& operator >>(std::istream& is, ElementId& id)
47  {
48  is >> id.m_Value;
49  return is;
50  }
51 
52 
53  typedef std::set<ElementId> ElementIdSet;
54  typedef std::vector<ElementId> ElementIdList;
55  typedef std::map<ElementId, ElementId> ElementIdMap;
56 
57 }}
58 
59 #endif //_APIElementId_H_
#define AnyPlatformAPI_API
Definition: AnyPlatformAPI.h:8
std::map< ElementId, ElementId > ElementIdMap
Definition: APIElementId.h:55
bool operator>=(const ElementId &other) const
Definition: APIElementId.h:32
std::ostream & operator<<(std::ostream &os, const ElementId &id)
Definition: APIElementId.h:41
bool operator==(const ElementId &other) const
Definition: APIElementId.h:30
ElementId & operator++()
Definition: APIElementId.h:34
static const ElementId InvalidId
Definition: APIElementId.h:22
bool operator!=(const ElementId &other) const
Definition: APIElementId.h:31
The id.
Definition: APIElementId.h:16
int AsInt() const
Definition: APIElementId.h:24
std::istream & operator>>(std::istream &is, ElementId &id)
Definition: APIElementId.h:46
bool operator>(const ElementId &other) const
Definition: APIElementId.h:29
std::set< ElementId > ElementIdSet
Definition: APIElementId.h:53
bool operator<=(const ElementId &other) const
Definition: APIElementId.h:33
std::vector< ElementId > ElementIdList
Definition: APIElementId.h:54
bool operator<(const ElementId &other) const
Definition: APIElementId.h:28