SUAPI-CppWrapper
C++WrapperforSketchUpCAPI
ComponentInstance.hpp
1 //
2 // ComponentInstance.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 ComponentInstance_hpp
29 #define ComponentInstance_hpp
30 
31 #include <stdio.h>
32 
33 #include <SketchUpAPI/model/component_instance.h>
34 
35 #include "SUAPI-CppWrapper/Transformation.hpp"
36 #include "SUAPI-CppWrapper/model/Entity.hpp"
37 #include "SUAPI-CppWrapper/model/ComponentDefinition.hpp"
38 
39 namespace CW {
40 
42  friend class Group;
43  protected:
44  /** Creates a copy of the ComponentInstance */
45  SUComponentInstanceRef copy_reference(const ComponentInstance& other);
46 
47  public:
48  /**
49  * Constructor for null object
50  */
52 
53  ComponentInstance(SUComponentInstanceRef instance, bool attached = true);
54 
55  /** Copy constructor */
57 
58  /** Copy constructor for derived classes (Group) */
59  ComponentInstance(const ComponentInstance& other, SUComponentInstanceRef instance_ref);
60 
61  /** Destructor */
63 
64  /** Copy assignment operator */
66 
67  /**
68  * Returns the raw SUComponentInstance object.
69  */
70  SUComponentInstanceRef ref() const;
71 
72  /** Cast to native objects */
73  operator SUComponentInstanceRef() const;
74  operator SUComponentInstanceRef*();
75 
76  /**
77  * Returns the Transformation object applied to this instance.
78  */
80 
81  /**
82  * Set the transformation applied to this Component Instance
83  */
84  void transformation(const Transformation& tranform);
85 
86  /**
87  * Returns the Component Definition object of this instance.
88  */
90 
91  /**
92  * Returns the name of this instance.
93  */
94  String name() const;
95 
96  /**
97  * Sets the name of this instance.
98  */
99  void name(const String& string);
100 
101 };
102 
103 } /* namespace CW */
104 #endif /* ComponentInstance_hpp */
bool attached() const
Returns true if the entity is attached to another object.
Definition: Entity.cpp:100
SUComponentInstanceRef copy_reference(const ComponentInstance &other)
Transformation transformation() const
ComponentDefinition definition() const
ComponentInstance & operator=(const ComponentInstance &other)
Definition: Color.hpp:34
SUComponentInstanceRef ref() const