Exemplo n.º 1
0
/*
 * LoadRsc: Loads the RESOURCE_RSC_SPEC files (.rsc or .rsb).
 */
void LoadRsc(void)
{
   char file_load_path[MAX_PATH+FILENAME_MAX];
   char *filespec = ConfigStr(RESOURCE_RSC_SPEC);
   char *filepath = ConfigStr(PATH_RSC);

   int files_loaded = 0;
   sprintf(file_load_path, "%s%s", filepath, filespec);
   StringVector files;
   if (FindMatchingFiles(file_load_path, &files))
   {
      for (StringVector::iterator it = files.begin(); it != files.end(); ++it)
      {
         sprintf(file_load_path, "%s%s", filepath, it->c_str());

         if (RscFileLoad(file_load_path, EachLoadRsc))
         {
            if (stricmp(filespec, "*.rsb") == 0)
               LoadRSBHash(file_load_path);
            files_loaded++;
         }
         else
            eprintf("LoadRsc error loading %s\n", it->c_str());
      }
   }

   dprintf("LoadRsc loaded %i of %i found %s files\n",
      files_loaded, files.size(), filespec);

}
Exemplo n.º 2
0
void LoadBof(void)
{
	char file_load_path[MAX_PATH+FILENAME_MAX];
	char file_copy_path[MAX_PATH+FILENAME_MAX];
	
	int files_loaded = 0;
	
	sprintf(file_load_path,"%s%s",ConfigStr(PATH_BOF),BOF_SPEC);
   StringVector files;
   if (FindMatchingFiles(file_load_path, &files))
   {
      for (StringVector::iterator it = files.begin(); it != files.end(); ++it)
      {
			sprintf(file_load_path,"%s%s",ConfigStr(PATH_BOF), it->c_str());
			sprintf(file_copy_path,"%s%s",ConfigStr(PATH_MEMMAP), it->c_str());
			if (BlakMoveFile(file_load_path,file_copy_path))
				files_loaded++;
      }
   }
	
	/*
	if (!files.empty())
	dprintf("LoadBof moved in %i of %i found new .bof files\n",files_loaded,files.size());
	*/

	//dprintf("starting to load bof files\n");
	files_loaded = 0;
	
	sprintf(file_load_path,"%s%s",ConfigStr(PATH_MEMMAP),BOF_SPEC);
   if (FindMatchingFiles(file_load_path, &files))
   {
      for (StringVector::iterator it = files.begin(); it != files.end(); ++it)
      {
			sprintf(file_load_path,"%s%s",ConfigStr(PATH_MEMMAP), it->c_str());
			
			if (LoadBofName(file_load_path))
				files_loaded++;
			else
				eprintf("LoadAllBofs can't load %s\n", it->c_str());
		}
	}
	
	SetClassesSuperPtr();
	SetClassVariables();
	SetMessagesPropagate();

	dprintf("LoadBof loaded %i of %i found .bof files\n",files_loaded,files.size());
}
EStatusCode Type1ToCFFEmbeddedFontWriter::WriteStringIndex()
{
	
	mPrimitivesWriter.WriteCard16((unsigned short)mStrings.size());
	if(mStrings.size() > 0)
	{
		// calculate the total data size to determine the required offset size
		unsigned long totalSize=0;
		StringVector::iterator it = mStrings.begin();
		for(; it != mStrings.end(); ++it)
			totalSize += (unsigned long)it->size();
		
		Byte sizeOfOffset = GetMostCompressedOffsetSize(totalSize + 1);
		mPrimitivesWriter.WriteOffSize(sizeOfOffset);
		mPrimitivesWriter.SetOffSize(sizeOfOffset);
	
		unsigned long currentOffset = 1;

		// write the offsets
		for(it = mStrings.begin(); it != mStrings.end(); ++it)
		{
			mPrimitivesWriter.WriteOffset(currentOffset);
			currentOffset += (unsigned long)it->size();
		}
		mPrimitivesWriter.WriteOffset(currentOffset);

		// write the data
		for(it = mStrings.begin(); it != mStrings.end(); ++it)
			mFontFileStream.Write((const Byte*)(it->c_str()),it->size());
	}

	return mPrimitivesWriter.GetInternalState();
}
QStringList FaerieAnimationsDelegate::GetAnimationsList() {
	StringVector names = _collection->GetAnimationsNames();
	QStringList animationsList;
	for (StringVector::iterator i = names.begin(); i != names.end(); ++i) {
		animationsList.push_back(tr(i->c_str()));
	}
	return animationsList;
}
Exemplo n.º 5
0
VmbErrorType EnumFeature::GetValues( const char **pRange, VmbUint32_t &rnSize )
{
    if ( NULL == m_pFeatureContainer )
    {
        return VmbErrorDeviceNotOpen;
    }

    VmbUint32_t nCount = 0;
    VmbError_t res = VmbFeatureEnumRangeQuery( m_pFeatureContainer->GetHandle(), m_featureInfo.name.c_str(), NULL, 0, &nCount );

    if (    VmbErrorSuccess == res
            && 0 < nCount )
    {
        std::vector<const char*> data( nCount );

        res = VmbFeatureEnumRangeQuery( m_pFeatureContainer->GetHandle(), m_featureInfo.name.c_str(), &data[0], nCount, &nCount );

        if ( VmbErrorSuccess == res )
        {
            m_EnumStringValues.clear();

            for (   std::vector<const char*>::iterator iter = data.begin();
                    data.end() != iter;
                    ++iter )
            {
                m_EnumStringValues.push_back( std::string( *iter ));
            }

            if ( NULL == pRange )
            {
                rnSize = (VmbUint32_t)m_EnumStringValues.size();
                res = VmbErrorSuccess;
            }
            else if ( m_EnumStringValues.size() <= rnSize )
            {
                VmbUint32_t i = 0;
                for (   StringVector::iterator iter = m_EnumStringValues.begin();
                        m_EnumStringValues.end() != iter;
                        ++iter, ++i )
                {
                    pRange[i] = iter->c_str();
                }
                rnSize = (VmbUint32_t)m_EnumStringValues.size();
                res = VmbErrorSuccess;
            }
            else
            {
                res = VmbErrorMoreData;
            }
        }
    }

    return (VmbErrorType)res;
}
Exemplo n.º 6
0
int main ( )
{

	PME regex ( ", " );
	int i = regex.split ( "very, very2, tired" );

	for ( int j = 0; j < i; j++ ) {
		
		printf ( "%s\n", regex [ j ].c_str ( ) );

	}

	StringVector sv = regex.GetStringVector ( );
	
	for ( StringVector::iterator i = sv.begin ( );
		  i != sv.end ( );
		  i++ ) {

		printf ( "%s\n", i->c_str ( ) );

	}


	PME match ( "([a-z])([0-9])([A-Z])" );

	match.match ( "b2Z" );

	sv = match.GetStringVector ( );

	for ( StringVector::iterator i = sv.begin ( );
		  i != sv.end ( );
		  i++ ) {

		printf ( "%s\n", i->c_str ( ) );

	}

}
Exemplo n.º 7
0
void LoadRsc(void)
{
	char file_load_path[MAX_PATH+FILENAME_MAX];
	
	int files_loaded = 0;
	StringVector files;
	if (FindMatchingFiles(ConfigStr(PATH_RSC), RSC_EXTENSION, &files))
	{
		for (StringVector::iterator it = files.begin(); it != files.end(); ++it)
		{
			sprintf(file_load_path,"%s%s",ConfigStr(PATH_RSC), it->c_str());
			
			if (RscFileLoad(file_load_path,EachLoadRsc))
				files_loaded++;
			else
				eprintf("LoadRsc error loading %s\n", it->c_str());
		}
	}
	
	/*
	dprintf("LoadRsc loaded %i of %i found .rsc files\n",files_loaded,files.size());
	*/
}
Exemplo n.º 8
0
void NotesHelper::CreateNotesMessage(const std::tstring& recipients, const std::tstring& subject, StringVector& body, LNMailMessage &message)
{
	LNSTATUS status = Session::Instance()->GetNotesSession().CreateMailMessage(&message);
	if(NOERROR != status)
	{
		std::vector<char> errorbuffer(LNERROR_MESSAGE_LENGTH);
		LNINT charCount = LNGetErrorMessage(status, &errorbuffer[0]);
		throw CppUnitException(std::tstring(errorbuffer.begin(), errorbuffer.begin() + charCount), __LINE__, _T(__FILE__));	
	}

	message.SendTo(Workshare::Conversions::W22LNString(recipients.c_str()));
	message.SetSubject(Workshare::Conversions::W22LNString(subject.c_str()));
		
	LNRichText rtBody;
	message.GetBody(&rtBody);

	for(StringVector::iterator bodyIter = body.begin(); bodyIter != body.end(); ++bodyIter)
	{
		rtBody.Append(Workshare::Conversions::W22LNString(bodyIter->c_str()));
	}
}