//--------------------------------------------------------------------------------------------------- void CSlurperApp::buildDisplayStrings(COptions& options) { // Set the default if it's not set if (options.exportFormat.IsEmpty()) options.exportFormat = "json"; const SFString fmtForFields = getFormatString(options, "field"); ASSERT(!fmtForFields.IsEmpty()); SFString defList = config.GetProfileStringGH("DISPLAY_STR", "fmt_fieldList", EMPTY); SFString fieldList = config.GetProfileStringGH("DISPLAY_STR", "fmt_"+options.exportFormat+"_fieldList", defList); if (fieldList.IsEmpty()) fieldList = GETRUNTIME_CLASS(CTransaction)->listOfFields(); SFString origList = fieldList; theAccount.displayString = EMPTY; theAccount.header = EMPTY; while (!fieldList.IsEmpty()) { SFString fieldName = nextTokenClear(fieldList, '|'); SFBool force = fieldName.Contains("*");fieldName.Replace("*",EMPTY); const CFieldData *field = GETRUNTIME_CLASS(CTransaction)->FindField(fieldName); if (!field) { outErr << "Field '" << fieldName << "' not found in fieldList '" << origList << "'. Quitting...\n"; exit(0); } if (field->isHidden() && force) ((CFieldData*)field)->setHidden(FALSE); if (!field->isHidden()) { SFString resolved = fieldName; if (options.exportFormat!="json") resolved = config.GetProfileStringGH("FIELD_STR", fieldName, fieldName); theAccount.displayString += fmtForFields.Substitute("{FIELD}", "{" + toUpper(resolved)+"}").Substitute("{p:FIELD}", "{p:"+resolved+"}"); theAccount.header += fmtForFields.Substitute("{FIELD}", resolved).Substitute("[",EMPTY).Substitute("]",EMPTY).Substitute("<td ","<th "); } } theAccount.displayString = StripAny(theAccount.displayString, "\t "); theAccount.header = StripAny(theAccount.header, "\t "); // This is what we're really after const SFString fmtForRecords = getFormatString(options, "record"); ASSERT(!fmtForRecords.IsEmpty()); theAccount.displayString = Strip(fmtForRecords.Substitute("[{FIELDS}]", theAccount.displayString), '\t'); if (options.exportFormat=="json") { // One little hack to make raw json more readable theAccount.displayString.ReplaceReverse("}]\",","}]\"\n"); if (options.prettyPrint) { theAccount.displayString.ReplaceAll("\"[{p:", " \"[{p:"); theAccount.displayString.ReplaceAll("}]\",", "}]\",\n"); theAccount.displayString.ReplaceAll("\":\"", "\": \""); } } }
std::string CViewTextFormated::getProperty( const std::string &name ) const { if( name == "format" ) { return getFormatString().toString(); } else return CViewText::getProperty( name ); }
void gemcubeframebuffer :: printInfo() { std::string format = getFormatString(m_format); std::string internalformat = getFormatString(m_internalformat); std::string rectangle; switch(m_rectangle?m_canRectangle:GL_TEXTURE_2D) { case GL_TEXTURE_2D: rectangle="2D"; break; case GL_TEXTURE_RECTANGLE_ARB: rectangle="RECTANGLE(ARB)"; break; #if 0 /* TR_ARB == TR_EXT for all practical purposes */ case GL_TEXTURE_RECTANGLE_EXT: rectangle="RECTANGLE(EXT)"; break; #endif default: rectangle="<unknown>"; } std::string type; switch(m_type) { case GL_UNSIGNED_BYTE: type="BYTE"; break; case GL_FLOAT : type="FLOAT"; break; default : type="unknown"; } verbose(0, "size: %dx%d", m_width, m_height); //verbose(0, "rectangle: %d -> %s", m_rectangle, rectangle.c_str()); verbose(0, "format: %s/%s [%d/%d]", format.c_str(), internalformat.c_str(), m_format, m_internalformat); verbose(0, "type: %s [%d]", type.c_str(), m_type); verbose(0, "texunit: %d", m_texunit); }
xmlNodePtr CViewTextFormated::serialize( xmlNodePtr parentNode, const char *type ) const { xmlNodePtr node = CViewText::serialize( parentNode, type ); if( node == NULL ) return NULL; xmlSetProp( node, BAD_CAST "type", BAD_CAST "text_formated" ); xmlSetProp( node, BAD_CAST "format", BAD_CAST getFormatString().c_str() ); return NULL; }
//--------------------------------------------------------------------------------------------------- SFBool CSlurperApp::Display(COptions& options, SFString& message) { double start = vrNow(); theAccount.Format(outScreen, getFormatString(options, "file")); if (!isTesting) { double stop = vrNow(); double timeSpent = stop-start; fprintf(stderr, "\tExported %ld records in %f seconds \n\n", theAccount.nVisible, timeSpent); fflush(stderr); } return TRUE; }