bool FileRetriever::retrieve(Url* url, Config* config, Message* message, Resolver* resolver)
{
    guessType(url);

    int id = 0;
    url->m_statusText = "KO";
    resolver->getOrAdd(url->getUrlString(), &id);

    // create the parser associated with this type of content
    m_parser = Parser::getParserByContent(url, resolver, message, url->m_contentType);

    if (m_parser != 0) {
        if (url->m_contentType.substr(0, 6) == "image/") {
            std::ifstream fis(url->m_urlPath.c_str());
            if (fis != 0) {
                char* buffer;
                size_t size;
                fis.seekg (0, std::ios_base::end);
                size = fis.tellg();
                fis.seekg (0, std::ios_base::beg);
                buffer = new char [size];
                fis.read(buffer, size);
                fis.close();
                m_parser->processData(config, (const unsigned char*) buffer, size);
                delete [] buffer;
                url->m_statusText = "OK";
            }
        }
        else {
            std::ifstream fis(url->m_urlPath.c_str());
            if (fis != 0) {
                while (!fis.eof()) {
                    std::string test;
                    std::getline(fis, test);
                    m_parser->processData(config, (const unsigned char*) test.c_str(), test.length());
                }
                url->m_statusText = "OK";
            }
        }

        if (url->m_statusText != "OK") {
            message->addMessage("Could not open file " + url->m_urlPath, 1);
            url->m_statusText = "Not Found";
            return false;
        }
    }
    else {
        // so message of no handler gets printed
        url->m_statusText = "OK";
    }

    return true;
}
inline void from_buffer(I3Frame &element, const char *buffer, std::size_t size)
{
    boost::iostreams::array_source src(buffer, size);
    boost::iostreams::filtering_istream fis(src);

    element.load(fis);
}
int main() {
#ifndef ONLINE_JUDGE
    std::ifstream fis("AverageSpeed.in");
    std::cin.rdbuf(fis.rdbuf());
#endif   
    std::string line;
    double currentSpeed = 0.0;
    size_t lastTime = 0;
    size_t totalTimeTraveled = 0;
    double distance = 0.0; 
    while (std::getline(std::cin, line)) {
        std::istringstream iss(line);
        std::string time; 
        std::string speed;
        iss >> time >> speed;
        size_t seconds = toSeconds(time);
        size_t delta = seconds - lastTime;
        lastTime = seconds;
        totalTimeTraveled += delta;
        distance += static_cast<double>(delta) * currentSpeed;
        
        if (!speed.empty()) {
            currentSpeed = std::stod(speed) / 3600.00;
        } else {
            std::cout << toTime(totalTimeTraveled) << ' ' << std::fixed << std::setprecision(2) << distance << " km" << std::endl;
        }
    }
    return 0;
}
Esempio n. 4
0
    bool unpackNow() {
        wxFFileInputStream fis(version + ".tgz");
        wxZlibInputStream zlis(fis);
        wxTarInputStream tis(zlis);

        if (!tis.CanRead()) {
            return false;
        }

        std::auto_ptr<wxTarEntry> entry;
        while (entry.reset(tis.GetNextEntry()), entry.get() != NULL) {
            // access meta-data
            wxString name = entry->GetName();
            printf("%s\n", name.c_str());
            if (name == "Tibia/Tibia.pic" || name == "Tibia\\Tibia.pic") {
                castEvent(10);
                unpackEntry(tis, "Tibia.pic");
            } else if (name == "Tibia/Tibia.dat" || name == "Tibia\\Tibia.dat") {
                castEvent(11);
                unpackEntry(tis, "Tibia.dat");
            } else if (name == "Tibia/Tibia.spr" || name == "Tibia\\Tibia.spr") {
                castEvent(12);
                unpackEntry(tis, "Tibia.spr");
            } else {
                printf("Name unrecognized\n");
                castEvent(9);
            }
        }
        return true;
    }
Esempio n. 5
0
bool FileCache::loadByPath(const std::string &path, std::ostream &os)
{
	std::ifstream fis(path.c_str(), std::ios_base::binary);

	if(!fis.good()){
		verbosestream<<"FileCache: File not found in cache: "
				<<path<<std::endl;
		return false;
	}

	bool bad = false;
	for(;;){
		char buf[1024];
		fis.read(buf, 1024);
		std::streamsize len = fis.gcount();
		os.write(buf, len);
		if(fis.eof())
			break;
		if(!fis.good()){
			bad = true;
			break;
		}
	}
	if(bad){
		errorstream<<"FileCache: Failed to read file from cache: \""
				<<path<<"\""<<std::endl;
	}

	return !bad;
}
Esempio n. 6
0
int main(int argc, char **argv)
{
    if (argc != 5)
        die_printf("Usage: %s <file> <prefix> <new-uri> <outfile>\n",
                   argv[0]);

    try
    {

        std::string file    = argv[1];
        std::string prefix  = argv[2];
        std::string uri     = argv[3];
        std::string outfile = argv[4];

        std::cout << "Replacing all matching prefixes " << prefix
            << " with uri " << uri << std::endl;
        io::FileInputStream fis( file );

        xml::lite::MinidomParser parser;
        parser.parse(fis);
        xml::lite::Element* topLevel = parser.getDocument()->getRootElement();
        topLevel->setNamespaceURI( prefix, uri );
        io::FileOutputStream fos( outfile );
        topLevel->prettyPrint( fos );
    }
    catch (except::Throwable& anything)
    {
        std::cout << "Caught throwable: " << anything.getType() << " "
        << anything.toString() << std::endl;

    }

}
Esempio n. 7
0
int main() {
#ifndef ONLINE_JUDGE
    std::ifstream fis("3n+1.in");
    std::cin.rdbuf(fis.rdbuf());
#endif

    const int MAX = 1000000;
    std::vector<long> cycleLengths(MAX, 0);

    for (int i = 1; i < MAX; i++) { 
        cycleLengths[i] = getCycleLength(i, cycleLengths);
    }

    std::string line;
    while (std::getline(std::cin, line)) {
        std::istringstream ss(line);
        int i, j;
        ss >> i >> j;

        int ii = i, jj = j;
        if (i > j) { 
            std::swap(ii, jj);
        }

        long max = 0;        
        for (int k = ii; k <= jj; k++) {
            max = std::max(max, cycleLengths[k]);
        }
        std::cout << i << ' ' << j << ' ' << max << std::endl;
    }
    
    return 0;
}
Esempio n. 8
0
bool CollectForOutput::collectDocument()
{
    QFileInfo fi = QFileInfo(m_outputDirectory);
    newName = m_outputDirectory;
    if (!fi.exists())
        return false;
    if (!fi.isDir() || !fi.isWritable())
        return false;

    if ((m_Doc->hasName) && (!m_Doc->isConverted))
    {
        QFileInfo fis(m_Doc->DocName);
        newName += fis.fileName();
    }
    else
        newName += m_Doc->DocName+".sla";

    m_Doc->hasName = true;
    if (m_compressDoc)
    {
        if (!newName.endsWith(".gz"))
            newName += ".gz";
    }
    else
    {
        if (newName.endsWith(".gz"))
            newName = newName.remove(".gz");
    }

    if (!overwrite(ScCore->primaryMainWindow(), newName))
        return false;
    if (!ScCore->primaryMainWindow()->DoFileSave(newName))
        return false;
    return true;
}
Esempio n. 9
0
void DeepScanner::processFile(FIFile* pFile)
{
	Error error;
	class SkipFile {};

	try
	{
		Path path = pFile->getAbsolutePath(error, m_db.m_root);
		if (error)
			throw SkipFile();

		m_fProgress = Real64(m_iCurItem) / Real64(m_db.m_pFIFiles.size());
		progressReport(path);

		FileInputStream fis(error, path);
		if (error)
			throw SkipFile();

		FIIndex* pIndex = vivFileIndex(error, fis);

		if (error)
			throw SkipFile();

		pFile->setFIIndex(pIndex);
		pIndex->addFIFile(pFile);
	}
	catch (SkipFile&)
	{
		UTF16 sErrorMessage = (error ? UTF16(error) : L"Unknown Error");

		skipWarning(pFile->getPath(), error);
	}
}
Esempio n. 10
0
void func_a_rm_not_op(func_t *f, func_is_t *fis)
{
  int i;
  if(f==NULL) return;
  for(i=0; i<func_asize(f); i++){ if(!fis(func_aget(f,i))){ func_adel(f,i); } }
  func_a_rm_null(f);
}
Esempio n. 11
0
void XmlMapHandler::Load(std::istream& file, Map& map)
{
    wxXmlDocument doc;
    wxFInputStream fis(file);
    if (!doc.Load(dynamic_cast<wxInputStream&>(fis)))
        throw "Could not open XML file";

    wxXmlNode* child = doc.GetRoot()->GetChildren();

    if (child != NULL && child->GetName() != "Properties")
        throw "Properties must be the first node in the XML file";

    ReadProperties(child, map);
    while ((child = child->GetNext()))
    {
        std::string name = child->GetName().ToStdString();
        VerboseLog("%s Got node %s", __func__, name.c_str());

        if (name == "Layer")
            ReadLayer(child, map);
        else if (name == "Background")
            ReadBackground(child, map);
        else if (name == "Collision")
            ReadCollision(child, map);
        else if (name == "Animation")
            ReadAnimation(child, map);
        else
            throw "Unknown element found in file " + name;
    }
}
Esempio n. 12
0
bool wxAnimationCtrl::LoadFile(const wxString &filename, wxAnimationType type)
{
    wxFileInputStream fis(filename);
    if (!fis.IsOk())
        return false;
    return Load(fis, type);
}
Esempio n. 13
0
int main(int argc, char** argv)
{
	Poco::JSON::Object::Ptr obj;

	std::string dir = Poco::Environment::get("POCO_BASE") + "/JSON/samples/Benchmark/";
	Poco::Path filePath(dir, "input");

	std::ostringstream ostr;

	if ( filePath.isFile() )
	{
		Poco::File inputFile(filePath);
		if ( inputFile.exists() )
		{
			Poco::FileInputStream fis(filePath.toString());
			Poco::StreamCopier::copyStream(fis, ostr);
		}
		else
		{
			std::cout << filePath.toString() << " doesn't exist!" << std::endl;
			return 1; 
		}
	}

	std::cout << std::setw(25) << "POCO JSON";

	std::string jsonStr = ostr.str();
	
	try
	{
		Poco::JSON::DefaultHandler handler;
		Poco::JSON::Parser parser;
		parser.setHandler(&handler);
		Poco::Timestamp time1;
		parser.parse(jsonStr);
		Poco::DynamicAny result = handler.result();
		Poco::Timestamp time2;
		printTimeDiff(time1, time2);

		if ( result.type() == typeid(Poco::JSON::Object::Ptr) )
		{
			obj = result.extract<Poco::JSON::Object::Ptr>();
		}

		//Serialize to string
		std::ostringstream out;
		Poco::Timestamp time3;
		obj->stringify(out);
		Poco::Timestamp time4;
		printTimeDiff(time3, time4);
		std::cout << std::endl;
	}
	catch(Poco::JSON::JSONException jsone)
	{
		std::cout << jsone.message() << std::endl;
	}

	return 0;
}
Esempio n. 14
0
int func_a_has_op(func_t *f, func_is_t *fis)
{
  int i;
  for(i=0; i<func_asize(f); i++){
    if(fis(func_aget(f,i))){ return 1; }
  }
  return 0;
}
Esempio n. 15
0
int func_a_has_op_pow1(func_t *f, func_is_t *fis)
{
  int value=0,i;
  for(i=0; i<func_asize(f); i++){
    if(fis(func_aget(f,i)) && func_has_power(func_aget(f,i)) && func_power(func_aget(f,i))==1){ value=1; }
  }
  return value;
}
inline void from_buffer(T &element, const char *buffer, std::size_t size)
{
    boost::iostreams::array_source src(buffer, size);
    boost::iostreams::filtering_istream fis(src);
    boost::archive::portable_binary_iarchive pia(fis);

    pia >> element;
}
Esempio n. 17
0
void SMTPChannel::log(const Message& msg)
{
	try
	{
		MailMessage message;
		message.setSender(_sender);
		message.addRecipient(MailRecipient(MailRecipient::PRIMARY_RECIPIENT, _recipient));
		message.setSubject("Log Message from " + _sender);
		std::stringstream content;
		content << "Log Message\r\n"
			<< "===========\r\n\r\n"
			<< "Host: " << Environment::nodeName() << "\r\n"
			<< "Logger: " << msg.getSource() << "\r\n";

		if (_local)
		{
			DateTime dt(msg.getTime());
			content	<< "Timestamp: " << DateTimeFormatter::format(LocalDateTime(dt), DateTimeFormat::RFC822_FORMAT) << "\r\n";
		}
		else
			content	<< "Timestamp: " << DateTimeFormatter::format(msg.getTime(), DateTimeFormat::RFC822_FORMAT) << "\r\n";

		content	<< "Priority: " << NumberFormatter::format(msg.getPriority()) << "\r\n"
			<< "Process ID: " << NumberFormatter::format(msg.getPid()) << "\r\n"
			<< "Thread: " << msg.getThread() << " (ID: " << msg.getTid() << ")\r\n"
			<< "Message text: " << msg.getText() << "\r\n\r\n";

		message.addContent(new StringPartSource(content.str()));
	
		if (!_attachment.empty())
		{
			{
				Poco::FileInputStream fis(_attachment, std::ios::in | std::ios::binary | std::ios::ate);
				if (fis.good())
				{
					int size = fis.tellg();
					char* pMem = new char [size];
					fis.seekg(std::ios::beg);
					fis.read(pMem, size);
					message.addAttachment(_attachment, new StringPartSource(std::string(pMem, size), _type, _attachment));
					delete [] pMem;
				}
			}
			if (_delete) File(_attachment).remove();
		}

		SMTPClientSession session(_mailHost);
		session.login();
		session.sendMessage(message);
		session.close();
	} 
	catch (Exception&) 
	{ 
		if (_throw) throw; 
	}
}
void Server::sendRequestedMedia(u16 peer_id,
		const std::vector<std::string> &tosend)
{
	DSTACK(FUNCTION_NAME);

	verbosestream<<"Server::sendRequestedMedia(): "
			<<"Sending files to client"<<std::endl;

	/* Read files */
	// TODO: optimize
	MediaData media_data;
	u32 size = 0;

	for(auto i = tosend.begin();
			i != tosend.end(); ++i) {
		const std::string &name = *i;

		if(m_media.find(name) == m_media.end()) {
			errorstream<<"Server::sendRequestedMedia(): Client asked for "
					<<"unknown file \""<<(name)<<"\""<<std::endl;
			continue;
		}

		//TODO get path + name
		std::string tpath = m_media[name].path;

		// Read data
		std::ifstream fis(tpath.c_str(), std::ios_base::binary);
		if(fis.good() == false){
			errorstream<<"Server::sendRequestedMedia(): Could not open \""
					<<tpath<<"\" for reading"<<std::endl;
			continue;
		}
		std::string contents;
		fis.seekg(0, std::ios::end);
		contents.resize(fis.tellg());
		fis.seekg(0, std::ios::beg);
		fis.read(&contents[0], contents.size());
		media_data.push_back(std::make_pair(name, contents));
		size += contents.size();
		if (size > 0xffff) {
			MSGPACK_PACKET_INIT(TOCLIENT_MEDIA, 1);
			PACK(TOCLIENT_MEDIA_MEDIA, media_data);
			m_clients.send(peer_id, 2, buffer, true);
			media_data.clear();
			size = 0;
		}
	}

	if (!media_data.empty()) {
		MSGPACK_PACKET_INIT(TOCLIENT_MEDIA, 1);
		PACK(TOCLIENT_MEDIA_MEDIA, media_data);
		m_clients.send(peer_id, 2, buffer, true);
	}
}
Esempio n. 19
0
int main() {
#ifndef ONLINE_JUDGE
    std::ifstream fis("11150.Cola.in");
    std::cin.rdbuf(fis.rdbuf());
#endif   
    std::string line;
    while (std::getline(std::cin, line)) {
        std::cout << cola(std::stoi(line), 0, 0) << std::endl;
    }
    return 0;
}
Esempio n. 20
0
 LuceneObjectPtr FieldInfos::clone(LuceneObjectPtr other)
 {
     SyncLock syncLock(this);
     FieldInfosPtr fis(newLucene<FieldInfos>());
     for (Collection<FieldInfoPtr>::iterator field = byNumber.begin(); field != byNumber.end(); ++field)
     {
         FieldInfoPtr fi(boost::dynamic_pointer_cast<FieldInfo>((*field)->clone()));
         fis->byNumber.add(fi);
         fis->byName.put(fi->name, fi);
     }
     return fis;
 }
Esempio n. 21
0
void copy(JFile from, JFile to) {
  try {
    JFileInputStream fis(from.getPath());
    JFileOutputStream fos(to.getPath());
    JBlock buf(32768, 0);
    for (;;) {
      fis >> buf;
      fos << buf;
    }
  } catch (JException* e) {
    delete e;
  }
}
void ConfirmDialog::ResetGridMetadata()
{
	wxString equipment_id;

	m_buttonLaunch->Enable(m_choiceProject->GetSelection()!=0) ;


	if(m_gridMetadata->GetNumberRows()>0)
	{
		equipment_id = m_gridMetadata->GetCellValue (1, 0);
		m_gridMetadata->DeleteRows (0, m_gridMetadata->GetNumberRows());
	}
	m_gridMetadata->InsertRows (0, 5) ;
	m_gridMetadata->SetRowLabelValue (0, wxT("session.datetime"));
	m_gridMetadata->SetRowLabelValue (1, wxT("session.equipment.id"));
	m_gridMetadata->SetRowLabelValue (2, wxT("session.project.id"));
	m_gridMetadata->SetRowLabelValue (3, wxT("session.project.name"));
	m_gridMetadata->SetRowLabelValue (4, wxT("session.project.leader"));

	m_gridMetadata->SetReadOnly (0, 0);
	m_gridMetadata->SetReadOnly (1, 0);
	m_gridMetadata->SetReadOnly (2, 0);
	m_gridMetadata->SetReadOnly (3, 0);
	m_gridMetadata->SetReadOnly (4, 0);
	
	m_gridMetadata->SetCellTextColour(0, 0, wxSystemSettings::GetColour( wxSYS_COLOUR_GRAYTEXT));
	m_gridMetadata->SetCellTextColour(1, 0, wxSystemSettings::GetColour( wxSYS_COLOUR_GRAYTEXT));
	m_gridMetadata->SetCellTextColour(2, 0, wxSystemSettings::GetColour( wxSYS_COLOUR_GRAYTEXT));
	m_gridMetadata->SetCellTextColour(3, 0, wxSystemSettings::GetColour( wxSYS_COLOUR_GRAYTEXT));
	m_gridMetadata->SetCellTextColour(4, 0, wxSystemSettings::GetColour( wxSYS_COLOUR_GRAYTEXT));


	m_gridMetadata->SetCellValue (0, 0, wxDateTime::Now().FormatISOCombined());
	m_gridMetadata->SetCellValue (1, 0, equipment_id);

	// load project metadata
	wxFileName projectINI(wxT("projects"), m_choiceProject->GetStringSelection(), wxT("ini")) ;

	// Set the tips as project name
	if(projectINI.FileExists())
	{
		wxFileInputStream fis(projectINI.GetFullPath()) ;
		wxFileConfig metadata_config(fis);
		metadata_config.SetStyle( metadata_config.GetStyle() | wxCONFIG_USE_NO_ESCAPE_CHARACTERS ) ;

		m_gridMetadata->SetCellValue (2, 0, m_choiceProject->GetStringSelection() );
		m_gridMetadata->SetCellValue (3, 0, metadata_config.Read(wxT("project/project.name")));
		m_gridMetadata->SetCellValue (4, 0, metadata_config.Read(wxT("project/project.owner")));
	}

}
Esempio n. 23
0
void func_add_args(func_t *f, func_is_t *fis, func_is_t *fin)
{
  int i,j;
  if(!func_is_add(f)){ FUNC_ERROR_ARG1("func_add_args",f); }
  for(i=0; i<func_asize(f); i++){
    for(j=0; fis(func_aget(f,i)) && j<func_asize(f); j++){
      if(i!=j && fin(func_aget(f,j))){
        func_aset(f,i,func_add(FR(func_aget(f,i)),FR(func_aget(f,j))));
	func_adel(f,j);
      }
    }
  }
  func_a_rm_null(f);
}
Esempio n. 24
0
void Converter::loadFontList( const string_t& fileName, std::set<string_t>& cnt )
{
    /// fonts
    Poco::FileInputStream fis(fileName);
    while (!fis.eof()) {
        string_t fontName;
        std::getline(fis, fontName);

        fontName = Poco::trim(fontName);
        if (fontName.empty())
            continue;
        cnt.insert( fontName );
    }
}
Esempio n. 25
0
main()
{
   char s[20] = "xxxxxxxxxxxxxxxxxxx";
   ifstream fis("text.txt");
   ofstream fos("text.txt");

   clrscr();

   fis.putback('s');
   fis.getline(s, 15);
   fos.write(s, strlen(s));
   cout<<s;

   getch();
   return 0;
}
Esempio n. 26
0
void Converter::loadKnownAsciiFonts( const string_t& languageDir,
    const string_t& language)
{
    string_t fontsKnow = languageDir + "font-known-ascii.txt";
    string_t charDefMapping = languageDir + "char-mapping-default.txt";

    tCharMappingSp defMapping(new CharMapping(charDefMapping));
    defMapping->setLanguage(language);

    /// open known fonts file and create mapping for each font
    Poco::FileInputStream fis(fontsKnow);

    while (!fis.eof()) {
        string_t sl;
        string_t fontName;
        string_t customMapFile;

        std::getline(fis, sl);

        /// check if there is custom mapping file specified current font
        string_t::size_type p = sl.find('|');
        fontName = sl.substr(0, p);
        
        sl = Poco::trim(sl);

        if (p != string_t::npos)
            customMapFile = sl.substr(p + 1);

        fontName = Poco::trimRight(fontName);
        customMapFile = Poco::trimLeft(customMapFile);

        if (fontName.empty())
            continue;

        if (customMapFile.empty()) {
            fontCharMaps_.insert( std::make_pair(fontName,
                defMapping) );
        }
        else {
            tCharMappingSp cm(new CharMapping);
            *cm = *defMapping;
            cm->updateCharMapping(languageDir + customMapFile);
            fontCharMaps_[fontName] = cm;
        }
    }
}
Esempio n. 27
0
bool CUpdate::loadConfig(const wxString& key, wxString* values, wxString fileName)
{
	if(fileName.IsEmpty())
	{
		fileName = m_configFile;
	}
	wxString	realFileName = m_skinDir +fileName;
	wxFileInputStream fis(realFileName);
	if (!fis.Ok())
	{
		assert("Config file not found.");
		return false;
	}
	wxFileConfig *conf = new wxFileConfig(fis);
	bool result = conf->Read(key, values);
	delete conf;
	return result;
}
Esempio n. 28
0
int main() {
#ifndef ONLINE_JUDGE
   std::ifstream fis("TheSnail.in");
   std::cin.rdbuf(fis.rdbuf());     
#endif
   int h, u, d, f;   

   while (std::cin >> h >> u >> d >> f && h) {
      int day = simulateSnail(h, u, d, f);
      if (day < 0) { 
          std::cout << "failure on day " << (-day) << std::endl; 
      } else {
          std::cout << "success on day " << day << std::endl;          
      }
   }

   return 0;
}
Esempio n. 29
0
void FileRequestHandler::handleRequest(Poco::Net::HTTPServerRequest& request, Poco::Net::HTTPServerResponse& response)
{
    setContentType(request, response);
    std::ostream& ostr = response.send();
    try {
        Poco::Path basedir = Poco::Util::Application::instance().config().getString("application.dir");
        basedir.append("web");
        basedir.append(request.getURI());
        Poco::FileInputStream fis(basedir.toString());
        Poco::StreamCopier::copyStream(fis, ostr);
        response.setStatus(Poco::Net::HTTPResponse::HTTPStatus::HTTP_OK);
    }
    catch (Poco::Exception& ex) {
        response.setStatus(Poco::Net::HTTPResponse::HTTPStatus::HTTP_NOT_FOUND);
        ostr << ex.displayText();
        _logger.error("Request failed: %s: %s", request.getURI(), ex.displayText());
    }

}
Esempio n. 30
0
bool Upgrade::loadIDMap(std::string mapFileName, StringUnsignedMap* outIdMap)
{
   const char* logContext = "Load IP map file";

   std::ifstream fis(mapFileName.c_str() );
   if(!fis.is_open() || fis.fail() )
   {
      LogContext(logContext).logErr("Failed to open ID-map-file: " + System::getErrString() );

      return false;
   }

   bool retVal = true;
   char line[STORAGETK_FILE_MAX_LINE_LENGTH];
   while(!fis.eof() && !fis.fail() )
   {
      fis.getline(line, STORAGETK_FILE_MAX_LINE_LENGTH);
      std::string trimmedLine = StringTk::trim(line);

      if(trimmedLine.length() && (trimmedLine[0] != STORAGETK_FILE_COMMENT_CHAR) )
      {
         unsigned numID;
         char stringID[513];

         int scanRes = sscanf(trimmedLine.c_str(), "%48s %u", stringID, &numID);
         if (scanRes == ID_MAP_FILE_COLUMS)
            outIdMap->insert(StringUnsignedMapVal(stringID, numID) );
         else
         {
            LogContext(logContext).logErr("Invalid line in map file (" + mapFileName + ")" +
               std::string(" Line: ") + line);
            break;
            retVal = false;
         }
      }
   }

   fis.close();

   return retVal;
}