static int ColorAttribute_print(PyObject *v, FILE *fp, int flags) { ColorAttributeObject *obj = (ColorAttributeObject *)v; fprintf(fp, "%s", PyColorAttribute_ToString(obj->data, "").c_str()); return 0; }
std::string PyColorAttribute_GetLogString() { std::string s("ColorAttribute = ColorAttribute()\n"); if(currentAtts != 0) s += PyColorAttribute_ToString(currentAtts, "ColorAttribute."); return s; }
static void PyColorAttribute_CallLogRoutine(Subject *subj, void *data) { typedef void (*logCallback)(const std::string &); logCallback cb = (logCallback)data; if(cb != 0) { std::string s("ColorAttribute = ColorAttribute()\n"); s += PyColorAttribute_ToString(currentAtts, "ColorAttribute."); cb(s); } }
std::string PyColorAttributeList_ToString(const ColorAttributeList *atts, const char *prefix) { std::string str; char tmpStr[1000]; { // new scope int index = 0; // Create string representation of colors from atts. for(AttributeGroupVector::const_iterator pos = atts->GetColors().begin(); pos != atts->GetColors().end(); ++pos, ++index) { const ColorAttribute *current = (const ColorAttribute *)(*pos); SNPRINTF(tmpStr, 1000, "GetColors(%d).", index); std::string objPrefix(prefix + std::string(tmpStr)); str += PyColorAttribute_ToString(current, objPrefix.c_str()); } if(index == 0) str += "#colors does not contain any ColorAttribute objects.\n"; } return str; }
PyObject * ColorAttribute_str(PyObject *v) { ColorAttributeObject *obj = (ColorAttributeObject *)v; return PyString_FromString(PyColorAttribute_ToString(obj->data,"").c_str()); }