19 return (value) ?
"true" :
"false";
22 template<
int VECTOR_SIZE,
typename T>
28 if (tokens.size() % VECTOR_SIZE != 0) {
32 value.resize(tokens.size() / VECTOR_SIZE);
33 for (
size_t i = 0; i < value.size(); i++) {
34 float *value_float = (
float *)&value[i];
36 for (
size_t j = 0; j < VECTOR_SIZE; j++)
37 value_float[j] = (
float)atof(tokens[i * VECTOR_SIZE + j].c_str());
43 xml_attribute name_attr = xml_node.attribute(
"name");
45 node->name = ustring(name_attr.value());
56 xml_attribute attr = xml_node.attribute(socket.
name.c_str());
62 switch (socket.
type) {
72 value.
resize(tokens.size());
73 for (
size_t i = 0; i < value.
size(); i++)
75 node->set(socket, value);
79 node->set(socket, (
float)atof(attr.value()));
84 xml_read_float_array<1>(value, attr);
85 node->set(socket, value);
89 node->set(socket, (
int)atoi(attr.value()));
93 node->set(socket, (
uint)atoi(attr.value()));
101 value.
resize(tokens.size());
102 for (
size_t i = 0; i < value.
size(); i++) {
103 value[i] = (int)atoi(attr.value());
105 node->set(socket, value);
113 xml_read_float_array<3>(value, attr);
114 if (value.
size() == 1) {
115 node->set(socket, value[0]);
124 xml_read_float_array<3>(value, attr);
125 node->set(socket, value);
130 xml_read_float_array<2>(value, attr);
131 if (value.
size() == 1) {
132 node->set(socket, value[0]);
138 xml_read_float_array<2>(value, attr);
139 node->set(socket, value);
143 node->set(socket, attr.value());
147 ustring value(attr.value());
149 node->set(socket, value);
153 "Unknown value \"%s\" for attribute \"%s\".\n",
155 socket.
name.c_str());
164 value.
resize(tokens.size());
165 for (
size_t i = 0; i < value.
size(); i++) {
166 value[i] = ustring(tokens[i]);
168 node->set(socket, value);
173 xml_read_float_array<12>(value, attr);
174 if (value.
size() == 1) {
175 node->set(socket, value[0]);
181 xml_read_float_array<12>(value, attr);
182 node->set(socket, value);
186 ustring value(attr.value());
187 map<ustring, Node *>::iterator it = reader.
node_map.find(value);
189 Node *value_node = it->second;
191 node->set(socket, it->second);
200 value.
resize(tokens.size());
201 for (
size_t i = 0; i < value.
size(); i++) {
202 map<ustring, Node *>::iterator it = reader.
node_map.find(ustring(tokens[i]));
204 Node *value_node = it->second;
211 node->set(socket, value);
220 if (!
node->name.empty())
226 xml_node xml_node = xml_root.append_child(
node->type->name.c_str());
228 xml_node.append_attribute(
"name") =
node->name.c_str();
237 if (
node->has_default_value(socket)) {
241 xml_attribute attr = xml_node.append_attribute(socket.
name.c_str());
243 switch (socket.
type) {
249 std::stringstream ss;
251 for (
size_t i = 0; i < value.
size(); i++) {
253 if (i != value.
size() - 1)
256 attr = ss.str().c_str();
264 std::stringstream ss;
266 for (
size_t i = 0; i < value.
size(); i++) {
268 if (i != value.size() - 1) {
272 attr = ss.str().c_str();
276 attr =
node->get_int(socket);
280 attr =
node->get_uint(socket);
284 std::stringstream ss;
286 for (
size_t i = 0; i < value.
size(); i++) {
288 if (i != value.size() - 1) {
292 attr = ss.str().c_str();
301 string_printf(
"%g %g %g", (
double)value.
x, (
double)value.
y, (
double)value.
z).c_str();
308 std::stringstream ss;
310 for (
size_t i = 0; i < value.
size(); i++) {
312 "%g %g %g", (
double)value[i].
x, (
double)value[i].
y, (
double)value[i].
z);
313 if (i != value.
size() - 1) {
317 attr = ss.str().c_str();
322 attr =
string_printf(
"%g %g", (
double)value.
x, (
double)value.
y).c_str();
326 std::stringstream ss;
328 for (
size_t i = 0; i < value.
size(); i++) {
330 if (i != value.
size() - 1) {
334 attr = ss.str().c_str();
339 attr =
node->get_string(socket).c_str();
343 std::stringstream ss;
345 for (
size_t i = 0; i < value.
size(); i++) {
347 if (i != value.size() - 1) {
351 attr = ss.str().c_str();
356 std::stringstream ss;
357 for (
int i = 0; i < 3; i++) {
365 attr = ss.str().c_str();
369 std::stringstream ss;
371 for (
size_t j = 0; j < value.
size(); j++) {
374 for (
int i = 0; i < 3; i++) {
382 if (j != value.
size() - 1) {
386 attr = ss.str().c_str();
390 Node *value =
node->get_node(socket);
392 attr = value->
name.c_str();
397 std::stringstream ss;
399 for (
size_t i = 0; i < value.
size(); i++) {
401 ss << value[i]->name.c_str();
403 if (i != value.
size() - 1) {
407 attr = ss.str().c_str();
typedef double(DMatrix)[4][4]
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble z
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint y
T * resize(size_t newsize)
#define CCL_NAMESPACE_END
xml_node xml_write_node(Node *node, xml_node xml_root)
static void xml_read_float_array(T &value, xml_attribute attr)
void xml_read_node(XMLReader &reader, Node *node, xml_node xml_node)
static const char * xml_write_boolean(bool value)
static CCL_NAMESPACE_BEGIN bool xml_read_boolean(const char *value)
bool string_iequals(const string &a, const string &b)
CCL_NAMESPACE_BEGIN string string_printf(const char *format,...)
void string_split(vector< string > &tokens, const string &str, const string &separators, bool skip_empty_tokens)
bool exists(ustring x) const
bool is_a(const NodeType *type)
const NodeType * node_type
const NodeEnum * enum_values
map< ustring, Node * > node_map