/usr/include/opencollada/COLLADAStreamWriter/COLLADASWParamBase.h is in opencollada-dev 0.1.0~20160714.0ec5063+dfsg1-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 | /*
Copyright (c) 2008-2009 NetAllied Systems GmbH
This file is part of COLLADAStreamWriter.
Licensed under the MIT Open Source License,
for details please see LICENSE file or the website
http://www.opensource.org/licenses/mit-license.php
*/
#ifndef __COLLADASTREAMWRITER_PARAM_H__
#define __COLLADASTREAMWRITER_PARAM_H__
#include "COLLADASWPrerequisites.h"
#include "COLLADASWElementWriter.h"
#include "COLLADASWAnnotation.h"
#include "COLLADASWValueType.h"
#include "COLLADASWSampler.h"
#include "COLLADASWConstants.h"
namespace COLLADASW
{
/** A class to add a param to the stream.*/
class ParamBase : public ElementWriter
{
protected:
/** Used to close the current param. */
TagCloser mParamCloser;
/** The parameter's name. */
String mParamName;
/** Flag, if the value element is opened. */
bool mValueElementIsOpen;
/** The type of the current parameter. */
ValueType::ColladaType mParamType;
public:
/** Constructor
@param streamWriter The stream the asset should be written to.*/
ParamBase (
StreamWriter* streamWriter,
const String* paramName=&CSWC::CSW_ELEMENT_PARAM,
const ValueType::ColladaType& paramType=ValueType::VALUE_TYPE_UNSPECIFIED );
/** Destructor*/
virtual ~ParamBase() {}
/** Set the current param type. */
void setParamType ( const ValueType::ColladaType& paramType );
/** Set the current param name. */
void setParamName ( const String& paramName );
/** Returns the name of the current parameter. */
const String& getParamName () const { return mParamName; }
/** Opens the current param element. */
virtual void openParam ( const String& refe="" );
/** Set a param attribute */
void appendAttribute ( const String& name, const String& val );
/** Writes the semantic of the parameter. */
void addSemantic ( const String &semantic );
/** Adds a annotation to the param. */
template <class T>
void addAnnotation (
const String &name,
const ValueType::ColladaType &valueType,
const T val )
{
COLLADASW::Annotation annotation ( mSW );
annotation.openAnnotation ( name );
annotation.openValuesElement ( valueType );
annotation.appendValues ( val );
annotation.closeValuesElement ();
annotation.closeAnnotation ();
}
/** Adds a annotation to the param. */
template <class T>
void addAnnotation (
const String &name,
const ValueType::ColladaType &valueType,
const T val,
const int nval )
{
COLLADASW::Annotation annotation ( mSW );
annotation.openAnnotation ( name );
annotation.openValuesElement ( valueType );
annotation.appendValues ( val, nval );
annotation.closeValuesElement ();
annotation.closeAnnotation ();
}
/** Adds a annotation to the param. */
void addAnnotations ( std::vector<Annotation>& annotations )
{
for ( size_t i=0; i<annotations.size (); ++i )
{
COLLADASW::Annotation& annotation = annotations [i];
annotation.add ();
}
}
/** Opens the param's value element of the given type. */
void openValuesElement ();
/** Close the param's value element of the given type. */
void closeValuesElement ();
/** Adds @a value to the array*/
template <class Type>
void appendValues ( const std::vector<Type>& value )
{
openValuesElement ();
mSW->appendValues ( value );
}
/** Adds @a value to the array*/
template <class Type>
void appendValues ( const Type value )
{
openValuesElement ();
mSW->appendValues ( value );
}
/** Adds @a value1 and @a value2 to the array*/
template <class Type>
void appendValues ( const Type value1, const Type value2 )
{
openValuesElement ();
mSW->appendValues ( value1, value2 );
}
/** Adds @a value1, @a value2 and @a value3 to the array*/
template <class Type>
void appendValues ( const Type value1, const Type value2, const Type value3 )
{
openValuesElement ();
mSW->appendValues ( value1, value2, value3 );
}
/** Adds @a value1, @a value2, @a value3 and @a value4 to the array*/
template <class Type>
void appendValues ( const Type value1, const Type value2, const Type value3, const Type value4 )
{
openValuesElement ();
mSW->appendValues ( value1, value2, value3, value4 );
}
/**
* This function must be called after the last value has been added to the array
* and before another element has been opened.
* @param closeSourceElement false, if we want to add some extra tags and close the element later.
*/
void closeParam ();
protected:
/** Returns the closer tag for the current parameter. */
TagCloser& getParamCloser () { return mParamCloser; }
/** Set the current tag closer. */
void setParamCloser ( const TagCloser& tagCloser ) { mParamCloser = tagCloser; }
};
} //namespace COLLADASW
#endif //__COLLADASTREAMWRITER_PARAM_H__
|