Example #1
0
	void PathUtil::splitPath(const String& path, String& dir, String& fname, String& ext) {
		dir = path;

		fname.clear();
		ext.clear();

		size_t slen = dir.length();
		size_t len = slen;

		// find extension
		for (; len>0; len--) {
			if (dir[len-1] == L'.') {
				ext = dir.c_str() + len - 1;
				dir.resize(len-1);
				break;
			}
		}

		// find file name;
		if (len == 0) len = slen;
		for (; len>0; len--) {
			if (isDirectoryLetter(dir[len-1])) {
				fname = dir.c_str() + len;
				dir.resize(len);
				break;
			}
		}

		return;
	}
Example #2
0
/**
    EnumerateAllQualifiers
    This method enumerates all the qualifiers in each of the nameSpaces
    of the "nameSpacesArray"
*/
static void enumerateAllQualifiers(
    TestModelWalkStressClient &tmsc,
    CIMClient* client,
    Array<CIMNamespaceName> nameSpacesArray,
    pid_t clientPid,
    String& clientLog,
    String &clientId,
    int status,
    String &pidFile)
{
    Array<CIMQualifierDecl> qualifierDecls;
    qualifierDecls.clear();

    for (Uint32 i=0; i < nameSpacesArray.size();i++)
    {
        try
        {
            qualifierDecls = client->enumerateQualifiers(nameSpacesArray[i]);

            if (status != CLIENT_PASS)
            {
                status = CLIENT_PASS;
                tmsc.logInfo(clientId, clientPid, status, pidFile);
            }
        }
        //
        // Following exceptions will be caught in the Main method.
        //
        catch (CIMException &e)
        {
            errorInfo.clear();
            errorInfo.append("CIMException in enumerateQualifiers : ");
            errorInfo.append(e.getMessage());
            CIMException cimExp(e.getCode(), errorInfo);
            throw cimExp;
        }
        catch (Exception &e)
        {
            errorInfo.clear();
            errorInfo.append("Exception in enumerateQualifiers : ");
            errorInfo.append(e.getMessage());
            Exception exp(errorInfo);
            throw exp;
        }
        catch (...)
        {
            Exception exp("General Exception in enumerateQualifiers ");
            throw exp;
        }
    }

    if (verboseTest)
    {
        errorInfo.clear();
        errorInfo.append("+++++ Successfully Enumerated Qualifiers for ");
        errorInfo.append("Namespaces +++++");
        tmsc.errorLog(clientPid, clientLog, errorInfo);
        errorInfo.clear();
    }
}
Example #3
0
String
strutil_findurl(String& str, String& url)
{
   static URLDetector s_detector;

   // the return value: the part of the text before the URL
   String before;

   int len;
   int pos = s_detector.FindURL(str, len);

   if ( pos == -1 )
   {
      // no URLs found
      str.swap(before);
      str.clear();
      url.clear();
   }
   else // found an URL
   {
      before = str.substr(0, pos);
      url = str.substr(pos, len);

      str.erase(0, pos + len);
   }

   return before;
}
void RequestTest::setUp( void )
{
  _req = 0;
  _type.clear();
  _size = 0;
  _body.clear();
}
TEST(SynchronousBuffer,CollectWord)
{
  SynchronousBuffer buffer;
  String word;
  char unused;
  int n;
  EXPECT_TRUE(buffer.refill("Phnglui mglw nafh Cthulhu R'lyeh "
                            "wgah nagl fhtagn"));
  EXPECT_TRUE(buffer.collectWord(word, &n));
  EXPECT_EQ(7, n);
  EXPECT_STREQ("Phnglui", word.text());
  word.clear();
  EXPECT_TRUE(buffer.next(unused));
  EXPECT_TRUE(buffer.collectWord(word, &n));
  EXPECT_EQ(4, n);
  EXPECT_STREQ("mglw", word.text());
  word.clear();
  EXPECT_TRUE(buffer.next(unused));
  EXPECT_TRUE(buffer.collectWord(word, &n));
  EXPECT_EQ(4, n);
  EXPECT_STREQ("nafh", word.text());
  word.clear();
  EXPECT_TRUE(buffer.next(unused));
  EXPECT_TRUE(buffer.collectWord(word, &n));
  EXPECT_EQ(7, n);
  EXPECT_STREQ("Cthulhu", word.text());
  word.clear();
  EXPECT_TRUE(buffer.next(unused));
}
Example #6
0
void testGet(bool debug,GatherV3DataPtr gather)
{
    String builder;
    NTTablePtr nttable = gather->getNTTable();
    bool result = gather->get();
    if(!result) printf("get failed\n%s\n",gather->getMessage().c_str());
    if(debug) {
        builder.clear();
        nttable->getPVStructure()->toString(&builder);
        printf("nttable\n%s\n",builder.c_str());
    }
    PVDoubleArrayPtr values = gather->getDoubleValue();
    PVIntArrayPtr severitys = gather->getAlarmSeverity();
    PVBooleanArrayPtr isConnecteds = gather->getIsConnected();
    PVStringArrayPtr channelNames = gather->getChannelName();
    if(debug) {
        builder.clear();
        values->toString(&builder);
        printf("value: %s\n",builder.c_str());
        builder.clear();
        severitys->toString(&builder);
        printf("severity: %s\n",builder.c_str());
        builder.clear();
        isConnecteds->toString(&builder);
        printf("isConnected: %s\n",builder.c_str());
        builder.clear();
        channelNames->toString(&builder);
        printf("channelName: %s\n",builder.c_str());
    }
}
Example #7
0
		int FormatV(String &Str,LPCWSTR pszFormat,va_list Args)
		{
			if (pszFormat==nullptr) {
				Str.clear();
				return 0;
			}

			int Length=::_vscwprintf(pszFormat,Args);
			if (Length<=0) {
				Str.clear();
				return 0;
			}
			static const int BUFFER_LENGTH=256;
			if (Length<BUFFER_LENGTH) {
				WCHAR szBuffer[BUFFER_LENGTH];
				::_vsnwprintf_s(szBuffer,BUFFER_LENGTH,_TRUNCATE,pszFormat,Args);
				Str=szBuffer;
			} else {
				LPWSTR pszBuffer=new WCHAR[Length+1];
				::_vsnwprintf_s(pszBuffer,Length+1,_TRUNCATE,pszFormat,Args);
				Str=pszBuffer;
				delete [] pszBuffer;
			}

			return (int)Str.length();
		}
Example #8
0
	void defaults (void)
	{
		title.clear();
		err.clear();
		line = col = fileMatch = -1;
		searchCol = false;
	}
Example #9
0
bool Path::CreateDirRecursive(String path)
{
	String path1;
	while(!path.empty())
	{
		String segment = path;
		size_t offset = path.find(Path::sep);
		if(offset != -1)
		{
			segment = path.substr(0, offset);
			if(path.size() > (offset + 1))
				path = path.substr(offset + 1);
			else
				path.clear();
		}
		else
		{
			path.clear();
		}

		if(!path1.empty())
			path1 += Path::sep;
		path1 += segment;

		// Create if not existing
		if(IsDirectory(path1) || path1.empty())
			continue;
		if(!CreateDir(path1))
			return false;
	}

	return true;
}
Example #10
0
void drivesList_SelChange(int notificationCode)
{
	if (notificationCode == CBN_SELENDOK) {
		StringStream ssLibPath;
		StringStream ssLocPath;
		String *temp = drivesList->getSelectedItem();
		ssLibPath << *temp;
		ssLocPath << *temp;
		ssLibPath << TEXT("iPod_Control\\iTunes\\iTunes Library.itlp\\Library.itdb");
		ssLocPath << TEXT("iPod_Control\\iTunes\\iTunes Library.itlp\\Locations.itdb");
		libraryPath.clear();
		locationsPath.clear();
		libraryPath = ssLibPath.str();
		locationsPath = ssLocPath.str();

		if (fileExists(&libraryPath) && fileExists(&locationsPath)) {
			status->setCaption(new String(TEXT("Found iTunes library")));
		} else {
			status->setCaption(new String(TEXT("iTunes library not found")));
			btnDownload->disable();
			return;
		}

		LibraryItem::containersDBPath = locationsPath;
		libItems.clear();
		Database lib(&libraryPath);
		lib.query(new std::string("select pid, title, artist, album from item where media_kind=1 order by artist"), libCallback);

		long long totalSize = 0;

		for (std::vector<LibraryItem *>::iterator i = libItems.begin(); i != libItems.end(); ++i) {
			LibraryItem *item = *i;
			int index = trackList->addItem(item->getArtist());
			trackList->addSubItem(item->getAlbum(), index, 1);
			trackList->addSubItem(item->getTitle(), index, 2);
			trackList->addSubItem(item->getContainer(), index, 3);
			trackList->addSubItem(item->getFilename(), index, 4);
			totalSize += (item->getSize() / 1024) / 1024;
		}

		StringStream *sum = new StringStream();
		*sum << TEXT("Total: ") << totalSize << TEXT(" Gb");

		summary->setCaption(new String(sum->str()));
		totalFiles = libItems.size();
		StringStream *totalProgress = new StringStream;
		*totalProgress << filesCopied << " / " << totalFiles;
		String *tmp = new String(totalProgress->str());
		progress->setCaption(tmp);
		delete totalProgress;
		delete tmp;

		if (!libItems.empty() && !targetDir->getText()->empty())
			btnDownload->enable();
		else
			btnDownload->disable();
	}
}
Example #11
0
/**
    EnumerateAssociatorNames
    This method enumerates the associators to each instance in the array
    "cimInstances" for the "nameSpace" 
*/
static void enumerateAssociatorNames(
    TestModelWalkStressClient &tmsc,
    CIMClient* client,
    Array<CIMInstance> cimNInstances,
    CIMNamespaceName nameSpace,
    CIMName assocClass,
    pid_t clientPid,
    String& clientLog,
    String &clientId,
    int status,
    String &pidFile)
{
    CIMName resultClass = CIMName();
    String role = String::EMPTY;
    String resultRole = String::EMPTY;
    Array<CIMObjectPath> resultObjectPaths;

    for (Uint32 i=0; i < cimNInstances.size(); i++)
    {
        try
        {
            resultObjectPaths = client->associatorNames(
                nameSpace, cimNInstances[i].getPath(),
                assocClass, resultClass, role, resultRole);

            if (status != CLIENT_PASS)
            {
                status = CLIENT_PASS;
                tmsc.logInfo(clientId, clientPid, status, pidFile);
            }
        }
        //
        // Following exceptions will be caught in the Main method.
        //
        catch (CIMException &e)
        {
            errorInfo.clear();
            errorInfo.append("CIMException in enumerateAssociatorNames : ");
            errorInfo.append(e.getMessage());
            CIMException cimExp(e.getCode(), errorInfo);
            throw cimExp;
        }
        catch (Exception &e)
        {
            errorInfo.clear();
            errorInfo.append("Exception in enumerateAssociatorNames : ");
            errorInfo.append(e.getMessage());
            Exception exp(errorInfo);
            throw exp;
        }
        catch (...)
        {
            Exception exp("General Exception in enumerateAssociatorNames ");
            throw exp;
        }
    }
}
Example #12
0
	void defaults (void)
	{
		title.clear(); cmd.clear(); compiler.clear();
		enable.clear(); disable.clear();
		saveType = saCurrent;
		jumpType = jtSmart;
		cd = cdNone;
		searchBase = false;
		echo = true;
	}
Example #13
0
void
_test (CIMClient & client)
{
  try
  {
    String wql ("WQL");
    String cql ("CIM:CQL");

    char cnt[512];
    String filter;
    String query;
    String handler;
    for (Uint32 i = 0; i < QUERIES; i++)
      {

	filter.clear ();
	sprintf (cnt, "%d", i);

	filter.append (_filter);
	filter.append (cnt);

	handler.clear ();
	handler.append (_handler);
	handler.append (cnt);

	query.clear ();
	query.append (queries[i]);

	if (verbose)
	  {
	    cerr << " Creating filter " << filter << endl;
	    cerr << " with query: " << query << endl;
	    cerr << " and handler" << handler << endl;
	  }
	_addFilter (client, filter, query, cql);

	_addHandler (client, handler, _destination);

	_addSubscription (client, filter, handler);

	_delete (client, filter, handler);
      }
  }

  catch (Exception & e)
  {
    cerr << "test failed: " << e.getMessage () << endl;
    exit (-1);
  }

  cout << "+++++ test completed successfully" << endl;
}
Example #14
0
/**
    EnumerateClassRelatedInfo
    This method enumerates classes and instances (by way of subrotine)  
*/
static void enumerateClassRelatedInfo(
    TestModelWalkStressClient &tmsc,
    CIMClient* client,
    OptionManager &om,
    Array<CIMNamespaceName> nameSpacesArray,
    pid_t clientPid,
    String& clientLog,
    String &clientId,
    int status,
    String &pidFile)
{
    Array<CIMName> classNames;
    String tmpClassName;

    om.lookupValue("classname",tmpClassName);
    if (tmpClassName != String::EMPTY)
    {
        classNames.append(CIMName(tmpClassName));
        enumerateInstanceRelatedInfo(tmsc, client, classNames,
            *nameSpacesArray.getData(), clientPid, clientLog, clientId,
            status, pidFile);
    }
    else
    {
        Boolean deepInheritance = true;
        CIMName className;
        for (Uint32 i=0; i < nameSpacesArray.size();i++)
        {
            classNames = client->enumerateClassNames(nameSpacesArray[i],
                className, deepInheritance);

            if (status != CLIENT_PASS)
            {
                status = CLIENT_PASS;
                tmsc.logInfo(clientId, clientPid, status, pidFile);
            }
            enumerateInstanceRelatedInfo(tmsc, client, classNames,
                nameSpacesArray[i], clientPid, clientLog, clientId, status,
                pidFile );
        }
    }
      if (verboseTest)
    {
        errorInfo.clear();
        errorInfo.append("+++++ Successfully Enumerated classes ");
        errorInfo.append("in Namespaces +++++");
        tmsc.errorLog(clientPid, clientLog, errorInfo);
        errorInfo.clear();
    }
}
bool ProviderManagerMap::getProvMgrPathForIfcType(String &ifcType,
    String &ifcVersion,
    String &path)
{
    path.clear();
    for (Uint32 ifc=0; ifc<_pmArray.size(); ifc++)
    {
        if (_pmArray[ifc].ifcName == ifcType)
        {
            if (ifcVersion.size()==0)
            {
                path = _pmArray[ifc].path;
                return true;
            }
            else for (Uint32 ver=0; ver<_pmArray[ifc].ifcVersions.size(); ver++)
            {
                if (_pmArray[ifc].ifcVersions[ver] == ifcVersion)
                {
                    path = _pmArray[ifc].path;
                    return true;
                }
            }
        }
    }
    return false;
}
Example #16
0
	void beginTestSuite(const String& suiteName) {
		//printf("Test Suite begin: %s\n", suiteName.c_str());	//mustn't trash the screen here
		printf("Test begins..\nPlease wait,\nrunning automated tests!\n");
		mNSuccesses = 0;
		mFailures.clear();
		mCurrentTestName.clear();
	}
Example #17
0
Format::ItemGroup::ItemGroup(std::basic_ifstream<Char> &from, const String &nam) : Item(nam) //Deserialize
{
	String n;
	int c;
	items_t::size_type size;
	from.read((Char*)&size, sizeof(size)/sizeof(Char));
	for(items_t::size_type i = 0; i < size; ++i)
	{
		for(n.clear(); c = from.get(); n += char(c));
		if((c = from.get()) == ItemGroup::TypeID)
		{
			items.push_back(new ItemGroup(from, n));
		}
		else if(c == Integer::TypeID)
		{
			items.push_back(new Integer(from, n));
		}
		else if(c == Float::TypeID)
		{
			items.push_back(new Float(from, n));
		}
		else if(c == Str::TypeID)
		{
			items.push_back(new Str(from, n));
		}
		else if(c == Raw::TypeID)
		{
			items.push_back(new Raw(from, n));
		}
		else
		{
			throw this;
		}
	}
}
Example #18
0
 const char * next() {
   temp_str.clear();
   WordEntry * w =  real_->next(); 
   if (!w) return 0;
   w->write(temp_str, *lang_);
   return temp_str.str();
 }
Example #19
0
void WikiParser::buildIndex(String &Html)
{
	String Tmp;
	// Index hinzufügen
	if (index.size()>3 && indexenabled==true) {
		Html+="<table class=index><tr><td>";
		Html+="<b>Inhaltsverzeichnis:</b><br>\n";
		Tmp="";
		//index.List("index");
		AssocArray::Iterator it;
		index.reset(it);
		String a;
		while (index.getNext(it,Variant::TYPE_ASSOCARRAY)) {
			const AssocArray &r=it.value().toAssocArray();
			a.repeat(L'*',r.getString("ebene").toInt());
			a.appendf(" %s\n",(const char*)r.getString("link"));
			Tmp+=a;
		}
		a.clear();
		WikiParser Wiki;
		Wiki.renderInternal(Tmp,a);
		Html+=a;
		Html+="</td></tr></table>\n";
	}
}
Example #20
0
	StringList String::split(String splitBy, int limitCount){
		StringList MyStrList;
		unsigned int Iter = 0;
		String MyStr = *this;
		String Current;

		for(unsigned int i = 0; i < MyStr.length(); i++){
			if(MyStr[i] == splitBy[Iter]){
				Iter++;
			}
			else{
				//Break a partial match
				Iter = 0;
			}

			Current += MyStr[i];

			if(Iter == splitBy.length()){
				if(limitCount != 0 && MyStrList.size() == limitCount)
					continue;
				Current.erase(Current.length() - Iter, Current.length());
				MyStrList.push_back(Current);
				Current.clear();
				Iter = 0; 
			}
		}
		Current.erase(Current.length() - Iter, Current.length());
		MyStrList.push_back(Current);

		return MyStrList;

	};
Example #21
0
int String::nextToken(const char* szSep, String& sPart)
{
  if (empty()) { return 0; } // do nothing

  int bFound = 0;

  const char* pSep = findChar(szSep);
  if (pSep != 0) {
    sPart.append(szStr_, pSep - szStr_, 1);
    String sRemain;
    sRemain.append(pSep, nBytes_ - (pSep - szStr_));
    const char* pNext = sRemain.findNotChar(szSep);
    if (pNext == 0) {
      clear();
    } else {
      append(pNext, sRemain.bytes() - (pNext - sRemain.c_str()), 1);
    }
    bFound = 1;
  } else {
    if (nBytes_ > 0) {
      sPart = szStr_;
      clear();
      bFound = 1;
    } else {
      sPart.clear();
    }
  }

  return bFound;
}
Example #22
0
static void
flush() noexcept {
    LockGuard lock(mutex);
    printf("%s", buf.null().get());
    buf.clear();
    scheduled = false;
}
void Document::loadFileToString( const String& file_name_, String &buffer_ )
{
	FRL_EXCEPT_GUARD();
	if( ! fs::exists( file_name_ ) )
		FRL_THROW_S_CLASS( Document::FileNotFound );
	size_t length = static_cast< size_t >( fs::file_size( file_name_ ) );
	if( length == 0 )
		FRL_THROW_S_CLASS( Document::EmptyFile );
	if( ! buffer_.empty() )
		buffer_.clear();

	static const size_t buffer_size = 4096;
	stream_std::InFile in( file_name_.c_str(), std::ios::binary );
	if( ! in.is_open() )
		FRL_THROW_S_CLASS( Document::UnknownError );
	std::vector< Char > buf( buffer_size );

	buffer_.reserve( length );
	while( in )
	{
		in.read( &buf[ 0 ], buffer_size );
		buffer_.append( &buf[ 0 ], in.gcount() );
	}
	in.close();
}
Example #24
0
void processLDFlags(const String& ldFlags, StringVec& libs) {
    // Tokenize flags
    StringVec ldFlagTokens;
    tokenize(ldFlags, ldFlagTokens, " \t", "", "\"'", "", "", true, false);

    // Expand -Wl, and -Xlinker tokens to make parsing easier
    StringVec ldFlagsFixed;
    replaceWlArgs(ldFlagTokens, ldFlagsFixed);

    String savedToken;
    for (auto opt : ldFlagsFixed) {
        if (savedToken.empty()) {
            opt = reduceLinkerToken(opt);
            if (opt == "-library" || opt == "-framework") {
                savedToken = opt;
            } else if (strBeginsWith(opt, "-l")) {
                String libName = strEndsWith(opt, ".o") ? opt.substr(2) : "lib" + opt.substr(2) + ".?";
                libs.push_back(libName);
            } else if (strEndsWith(opt, ".a") || strEndsWith(opt, ".dylib") || strEndsWith(opt, ".o")) {
                libs.push_back(opt);
            }
        } else {
            if (savedToken == "-library") {
                libs.push_back(opt);
            } else if (savedToken == "-framework") {
                std::string frameworkName = opt.substr(0, opt.find(',')) + ".framework";
                libs.push_back(frameworkName);
            }
            savedToken.clear();
        }
    }
}
Example #25
0
StringList SplitString( const String& splitMe, const String& splitChars, bool bRemoveEmptyEntries /*=true*/)
{
	StringList retVal;

	//iterate over string
	String buildString;
	for ( unsigned int i = 0; i < splitMe.length(); i++ )
	{
		char ch = splitMe[i];
		if( splitChars.find( ch ) != String::npos)
		{
			//Add the build string to our return val
			if( !bRemoveEmptyEntries || buildString.length() > 0 )
				retVal.push_back( buildString );
			buildString.clear();
		}
		else
		{
			buildString += ch;
		}
	}

	//handle any dangling strings
	if( buildString.length() > 0 )
		retVal.push_back( buildString );

	return retVal;
}
bool CvSakke::DecodePublicParams( const String& aPublicParams, OUT octet& aPx, OUT octet& aPy )
{
	CvString publicParams = aPublicParams;
	
	vector<CvString> tokens;
	publicParams.Tokenize( "#", tokens );
	
	if ( tokens.size() != 2 )
		return false;
	
	tokens[0].TrimLeft("[");
	tokens[0].TrimRight("]");
	
	vector<CvString> tokensP;
	tokens[0].Tokenize( ",", tokensP );
	
	if ( tokensP.size() != 2 )
		return false;
	
	String decoded;
	CvBase64::Decode( tokensP[0], decoded );
	OCTET_JOIN_BYTES( decoded.data(), (int)decoded.size(), &aPx );

	decoded.clear();
	CvBase64::Decode( tokensP[1], decoded );
	OCTET_JOIN_BYTES( decoded.data(), (int)decoded.size(), &aPy );
	
	return true;
}
bool HTTPBodyParameterMapper::DoFinalGetStream(const char *key, std::ostream &os, Context &ctx) {
	StartTrace1(HTTPBodyParameterMapper.DoFinalGetStream, NotNull(key));
	bool mapSuccess = true;
	ROAnything params(ctx.Lookup(key)); //!@FIXME ??: use Get(key,any,ctx) instead?
	if (!params.IsNull()) {
		long bPSz = params.GetSize();
		String value;
		for (long i = 0; i < bPSz; ++i) {
			const char *lookupVal = params.SlotName(i);
			if (!lookupVal) {
				lookupVal = params[i].AsCharPtr("");
			}
			if (lookupVal && (mapSuccess = Get(lookupVal, value, ctx))) {
				Trace("Param[" << lookupVal << "]=<" << value << ">");
				os << lookupVal << "=" << value;
				if (i < (bPSz - 1)) {
					os << "&";
				}
			} else {
				mapSuccess = true;
				os << lookupVal;
			}
			value.clear();
		}
	} else {
		String bodyParams;
		if ((mapSuccess = Get(key, bodyParams, ctx))) {
			os << bodyParams;
		}
	}
	Trace("retval: " << mapSuccess);
	return mapSuccess;
}
Example #28
0
void UnescapeHtml(String &strDst, const char *str)
{
	enum {
		STAT_Normal, STAT_Escape,
	} stat = STAT_Normal;
	String field;
	for (const char *p = str; *p != '\0'; p++) {
		char ch = *p;
		if (stat == STAT_Normal) {
			if (ch == '&') {
				field.clear();
				stat = STAT_Escape;
			} else {
				strDst += ch;
			}
		} else if (stat == STAT_Escape) {
			if (ch == ';') {
				if (field == "amp") {
					strDst += '&';
				} else if (field == "gt") {
					strDst += '>';
				} else if (field == "lt") {
					strDst += '<';
				} else if (field == "quot") {
					strDst += '"';
				}
				stat = STAT_Normal;
			} else {
				field += ch;
			}
		}
	}
}
String BinaryResources::browseForResource (const String& title,
                                           const String& wildcard,
                                           const File& fileToStartFrom,
                                           const String& resourceToReplace)
{
    FileChooser fc (title, fileToStartFrom, wildcard);

    if (fc.browseForFileToOpen())
    {
        String name (resourceToReplace);

        if (name.isEmpty())
            name = findUniqueName (fc.getResult().getFileName());

        if (! add (name, fc.getResult()))
        {
            AlertWindow::showMessageBox (AlertWindow::WarningIcon,
                                         TRANS("Adding Resource"),
                                         TRANS("Failed to load the file!"));

            name.clear();
        }

        return name;
    }

    return String::empty;
}
bool CvSakke::DecodeEncapsulatedData( const String& aEncapsulatedData, OUT octet& aRbS, OUT octet& aH )
{
	OCTET_CLEAR(&aRbS);
	OCTET_CLEAR(&aH);
	
	CvString encapsulatedData = aEncapsulatedData;
	
	vector<CvString> tokens;
	encapsulatedData.Tokenize( ",", tokens );
	
	if ( tokens.size() != 2 )
		return false;
	
	String decoded;

	CvBase64::Decode( tokens[0], decoded );
	if ( decoded.size() != aH.max )
		return false;
	OCTET_JOIN_BYTES( decoded.data(), aH.max, &aH );

	decoded.clear();
	CvBase64::Decode( tokens[1], decoded );
	if ( decoded.size() != aRbS.max )
		return false;
	OCTET_JOIN_BYTES( decoded.data(), aRbS.max, &aRbS );

	return true;
}