/** Sets TMeasureTextInputData::iFlags */ void CT_DataMeasureTextInput::DoCmdSetFlags(const TDesC& aSection) { INFO_PRINTF1(_L("Sets TMeasureTextInputData::iFlags")); // get value from parameters if ( !ReadFlags(aSection, iMeasureTextInput->iFlags) ) { ERR_PRINTF2(_L("No %S"), &aSection); SetBlockResult(EFail); } }
int DSVWriteCommand :: Execute( ALib::CommandLine & cmd ) { GetSkipOptions( cmd ); ReadFlags( cmd ); IOManager io( cmd ); CSVRow row; while( io.ReadCSV( row ) ) { if ( ! Skip( row ) ) { io.Out() << MakeDSV( row ) << "\n"; } } return 0; }
int DSVReadCommand :: Execute( ALib::CommandLine & cmd ) { ReadFlags( cmd ); mIsCSV = cmd.HasFlag( FLAG_CSV ); mCollapseSep = cmd.HasFlag( FLAG_CMULTI ); IOManager io( cmd ); CSVRow row; string line; while( io.ReadLine( line ) ) { ParseDSV( line, row ); io.WriteRow( row ); } return 0; }
CEffectTechnique::CEffectTechnique( const CXMLTreeNode& aTechniqueNode ) : CName( aTechniqueNode.GetAttribute<std::string>("name", "null") ) , m_DebugColor( Math::colWHITE ) , m_VertexType( aTechniqueNode.GetAttribute<uint32>("vertex_type", 0 ) ) , m_Filename( aTechniqueNode.GetAttribute<std::string>("file", "null_file") ) , mUseWorld ( false ) , mUseInverseWorld ( false ) , mUseView ( false ) , mUseInverseView ( false ) , mUseProjection ( false ) , mUseInverseProjection ( false ) , mUseViewProjection ( false ) , mUseWorldView ( false ) , mUseWorldViewProjection ( false ) , mUseViewToLightProjection ( false ) , mUseFog ( false ) , mUseLights ( false ) , mUseDebugColor ( false ) , mUseFBSize ( false ) , mUseAmbientLight ( false ) , mUseCamera ( false ) , mUseTime ( false ) , m_NumOfLights ( 0 ) { ASSERT( m_Filename != "null_file", "Check the file of the technique %s", GetName().c_str() ); //Use the compiled effect m_Filename = "../CommonData/fx/" + GetName() + ".o"; LOG_INFO_APPLICATION( "Loading effect tecnhique %s", m_Filename.c_str() ); for ( uint32 j = 0, lCount = aTechniqueNode.GetNumChildren(); j < lCount; ++j ) { const CXMLTreeNode& lCurrentNode = aTechniqueNode( j ); const std::string& l_TagName = lCurrentNode.GetName(); if ( l_TagName == "handles" ) { ReadFlags( lCurrentNode ); } #ifdef _DEBUG if( l_TagName == "define" ) { SDefines lDefine = { lCurrentNode.GetAttribute<std::string>("name", "null_name"), lCurrentNode.GetAttribute<std::string>("description", "") }; m_Defines.push_back(lDefine); } #endif } #ifdef _DEBUG // By default insert the definition of the technique name SDefines lDefine = { "TECHNIQUE_NAME", GetName() }; m_Defines.push_back(lDefine); #endif m_Effect = new CEffect(GetName() + "_Effect" ); bool lLoaded = m_Effect->Load( m_Filename, m_Defines ); ASSERT(lLoaded, "The effect %s could not be loaded" ); if( lLoaded ) { m_D3DTechnique = ( m_Effect ) ? m_Effect->GetTechniqueByName( GetName() ) : 0; } else { CHECKED_DELETE( m_Effect ); } }
int ezStringUtils::vsnprintf(char* szOutputBuffer, unsigned int uiBufferSize, const char* szFormat, va_list args0) { va_list args; va_copy(args, args0); EZ_ASSERT(ezUnicodeUtils::IsValidUtf8(szFormat), "The sprintf format string must be valid Utf8."); // make sure the last character is a \0 if ((szOutputBuffer) && (uiBufferSize > 0)) szOutputBuffer[uiBufferSize - 1] = '\0'; unsigned int uiReadPos = 0; unsigned int uiWritePos = 0; bool bError = false; while (szFormat[uiReadPos] != '\0') { const char c = szFormat[uiReadPos]; ++uiReadPos; // if c is not %, just print it out and be done with it if (c != '%') { OutputChar (szOutputBuffer, uiBufferSize, uiWritePos, c); continue; } // otherwise parse the formatting string to find out what has to be done char cNext = szFormat[uiReadPos]; // *** parse the format string *** // first read the flags (as many as there are) unsigned int Flags = ReadFlags (szFormat, uiReadPos, cNext); // read the width of the field int iWidth = ReadWidth (szFormat, uiReadPos, cNext); // read the precision specifier int iPrecision = ReadPrecision (szFormat, uiReadPos, cNext); // read the input data 'length' (short / int / long it, float / double) const sprintfLength::Enum Length = ReadLength (szFormat, uiReadPos, cNext); // read the 'specifier' type const char cSpecifier = ReadSpecifier (szFormat, uiReadPos, cNext, bError); if (bError) { snprintf (szOutputBuffer, uiBufferSize, "Error in formatting string at position %u ('%c').", uiReadPos, cSpecifier); va_end(args); return -1; } // if 'width' was specified as '*', read it from an extra parameter if (iWidth < 0) iWidth = va_arg (args, int); // if 'precision' was specified as '*', read it from an extra parameter if (iPrecision == -2) iPrecision = va_arg (args, int); // % Sign if (cSpecifier == '%') { OutputChar (szOutputBuffer, uiBufferSize, uiWritePos, '%'); continue; } // Nothing: Writes the current write position back to an int pointer if (cSpecifier == 'n') { int* p = va_arg (args, int*); if (p) *p = (int) uiWritePos; continue; } // String if (cSpecifier == 's') { const char* s = va_arg (args, const char*); OutputString (szOutputBuffer, uiBufferSize, uiWritePos, s, Flags, iWidth, iPrecision); continue; } // Character if (cSpecifier == 'c') { char c2 = va_arg (args, int); char s[2] = {c2, 0}; OutputString (szOutputBuffer, uiBufferSize, uiWritePos, s, Flags, iWidth, iPrecision); continue; }
void ReadLeaders() { ReadFlags(); ReadWidth(); if (*format_ == '.') ReadPrecision(); ReadModifiers(); }