SUAPI-CppWrapper
C++WrapperforSketchUpCAPI
Group.hpp
1 //
2 // Group.hpp
3 //
4 // Sketchup C++ Wrapper for C API
5 // MIT License
6 //
7 // Copyright (c) 2017 Tom Kaneko
8 //
9 // Permission is hereby granted, free of charge, to any person obtaining a copy
10 // of this software and associated documentation files (the "Software"), to deal
11 // in the Software without restriction, including without limitation the rights
12 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 // copies of the Software, and to permit persons to whom the Software is
14 // furnished to do so, subject to the following conditions:
15 
16 // The above copyright notice and this permission notice shall be included in all
17 // copies or substantial portions of the Software.
18 
19 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25 // SOFTWARE.
26 //
27 
28 #ifndef Group_hpp
29 #define Group_hpp
30 
31 #include <stdio.h>
32 
33 #include <SketchUpAPI/model/group.h>
34 
35 #include "SUAPI-CppWrapper/model/ComponentInstance.hpp"
36 
37 namespace CW {
38 
39 // Forward Declarations
40 class Entities;
41 class Transformation;
42 class ComponentDefinition;
43 class String;
44 
45 class Group :public ComponentInstance {
46  private:
47  /**
48  * Create new SUGroupRef object
49  */
50  static SUGroupRef create_group();
51 
52  static SUGroupRef copy_reference(const Group& other);
53 
54  public:
55  /**
56  * Construct a new, empty Group object.
57  */
58  Group();
59 
60  /**
61  * Construct a Group from an existing SUGroupRef object. Groups must always be attached to a parent (there is no release function for Groups)
62  */
63  Group(SUGroupRef group, bool attached = true);
64 
65  /**
66  * Construct a Group from instance object. If the instance is not a group, you will get errors, as the constructor does not check for this.
67  */
68  Group(const ComponentInstance& instance);
69 
70  /** Copy constructor */
71  Group(const Group& other);
72 
73  /** Destructor */
74  ~Group();
75 
76  /** Copy assignment operator */
77  Group& operator=(const Group& other);
78 
79  /**
80  * Returns the raw SUGroupRef object.
81  */
82  SUGroupRef ref() const;
83 
84  /*
85  * The class object can be converted to a SUGroupRef.
86  */
87  operator SUGroupRef() const;
88  operator SUGroupRef*();
89 
90  /**
91  * Return the ComponentDefinition of the Group.
92  */
94 
95  /**
96  * Return the Entities object of the Group.
97  */
98  Entities entities() const;
99 
100  /**
101  * Return the name of the Group.
102  */
103  String name() const;
104 
105  /**
106  * Set the name of this Group.
107  */
108  void name(const String& string);
109 
110  /**
111  * Return the Transformation object of the group.
112  */
114 
115  /**
116  * Set the Transformation of the group.
117  */
118  void transformation(const Transformation& transform);
119 
120 };
121 
122 } /* namespace CW */
123 
124 #endif /* Group_hpp */
SUGroupRef ref() const
Definition: Group.cpp:107
bool attached() const
Returns true if the entity is attached to another object.
Definition: Entity.cpp:100
ComponentDefinition definition() const
Definition: Group.cpp:117
Group()
Definition: Group.cpp:71
Group & operator=(const Group &other)
Definition: Group.cpp:99
Transformation transformation() const
Definition: Group.cpp:160
String name() const
Definition: Group.cpp:138
~Group()
Definition: Group.cpp:92
Definition: Color.hpp:34
Entities entities() const
Definition: Group.cpp:128