32 return (value) ?
"true" :
"false";
35 template<
int VECTOR_SIZE,
typename T>
41 if (tokens.size() % VECTOR_SIZE != 0) {
45 value.resize(tokens.size() / VECTOR_SIZE);
46 for (
size_t i = 0; i < value.size(); i++) {
47 float *value_float = (
float *)&value[i];
49 for (
size_t j = 0; j < VECTOR_SIZE; j++)
50 value_float[j] = (
float)atof(tokens[i * VECTOR_SIZE + j].c_str());
56 xml_attribute name_attr = xml_node.attribute(
"name");
58 node->name = ustring(name_attr.value());
69 xml_attribute attr = xml_node.attribute(socket.
name.c_str());
75 switch (socket.
type) {
85 value.
resize(tokens.size());
86 for (
size_t i = 0; i < value.
size(); i++)
88 node->set(socket, value);
92 node->set(socket, (
float)atof(attr.value()));
97 xml_read_float_array<1>(value, attr);
98 node->set(socket, value);
102 node->set(socket, (
int)atoi(attr.value()));
106 node->set(socket, (
uint)atoi(attr.value()));
114 value.
resize(tokens.size());
115 for (
size_t i = 0; i < value.
size(); i++) {
116 value[i] = (int)atoi(attr.value());
118 node->set(socket, value);
126 xml_read_float_array<3>(value, attr);
127 if (value.
size() == 1) {
128 node->set(socket, value[0]);
137 xml_read_float_array<3>(value, attr);
138 node->set(socket, value);
143 xml_read_float_array<2>(value, attr);
144 if (value.
size() == 1) {
145 node->set(socket, value[0]);
151 xml_read_float_array<2>(value, attr);
152 node->set(socket, value);
156 node->set(socket, attr.value());
160 ustring value(attr.value());
162 node->set(socket, value);
166 "Unknown value \"%s\" for attribute \"%s\".\n",
168 socket.
name.c_str());
177 value.
resize(tokens.size());
178 for (
size_t i = 0; i < value.
size(); i++) {
179 value[i] = ustring(tokens[i]);
181 node->set(socket, value);
186 xml_read_float_array<12>(value, attr);
187 if (value.
size() == 1) {
188 node->set(socket, value[0]);
194 xml_read_float_array<12>(value, attr);
195 node->set(socket, value);
199 ustring value(attr.value());
200 map<ustring, Node *>::iterator it = reader.
node_map.find(value);
202 Node *value_node = it->second;
204 node->set(socket, it->second);
213 value.
resize(tokens.size());
214 for (
size_t i = 0; i < value.
size(); i++) {
215 map<ustring, Node *>::iterator it = reader.
node_map.find(ustring(tokens[i]));
217 Node *value_node = it->second;
224 node->set(socket, value);
233 if (!
node->name.empty())
239 xml_node xml_node = xml_root.append_child(
node->type->name.c_str());
241 xml_node.append_attribute(
"name") =
node->name.c_str();
250 if (
node->has_default_value(socket)) {
254 xml_attribute attr = xml_node.append_attribute(socket.
name.c_str());
256 switch (socket.
type) {
262 std::stringstream ss;
264 for (
size_t i = 0; i < value.
size(); i++) {
266 if (i != value.
size() - 1)
269 attr = ss.str().c_str();
277 std::stringstream ss;
279 for (
size_t i = 0; i < value.
size(); i++) {
281 if (i != value.size() - 1) {
285 attr = ss.str().c_str();
289 attr =
node->get_int(socket);
293 attr =
node->get_uint(socket);
297 std::stringstream ss;
299 for (
size_t i = 0; i < value.
size(); i++) {
301 if (i != value.size() - 1) {
305 attr = ss.str().c_str();
314 string_printf(
"%g %g %g", (
double)value.
x, (
double)value.
y, (
double)value.
z).c_str();
321 std::stringstream ss;
323 for (
size_t i = 0; i < value.
size(); i++) {
325 "%g %g %g", (
double)value[i].
x, (
double)value[i].
y, (
double)value[i].
z);
326 if (i != value.
size() - 1) {
330 attr = ss.str().c_str();
335 attr =
string_printf(
"%g %g", (
double)value.
x, (
double)value.
y).c_str();
339 std::stringstream ss;
341 for (
size_t i = 0; i < value.
size(); i++) {
343 if (i != value.
size() - 1) {
347 attr = ss.str().c_str();
352 attr =
node->get_string(socket).c_str();
356 std::stringstream ss;
358 for (
size_t i = 0; i < value.
size(); i++) {
360 if (i != value.size() - 1) {
364 attr = ss.str().c_str();
369 std::stringstream ss;
370 for (
int i = 0; i < 3; i++) {
378 attr = ss.str().c_str();
382 std::stringstream ss;
384 for (
size_t j = 0; j < value.
size(); j++) {
387 for (
int i = 0; i < 3; i++) {
395 if (j != value.
size() - 1) {
399 attr = ss.str().c_str();
403 Node *value =
node->get_node(socket);
405 attr = value->
name.c_str();
410 std::stringstream ss;
412 for (
size_t i = 0; i < value.
size(); i++) {
414 ss << value[i]->name.c_str();
416 if (i != value.
size() - 1) {
420 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 exists(ustring x) const
bool is_a(const NodeType *type)
const NodeType * node_type
const NodeEnum * enum_values
map< ustring, Node * > node_map
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)