Example #1
0
 virtual ArchiveTextFile* openTextFile(const char* name)
 {
   files_t::iterator i = m_files.find(name);
   if(i != m_files.end())
   {
     return StoredArchiveTextFile::create(name, m_name.c_str(), i->second.m_position, i->second.m_stream_size);
   }
   return 0;
 }
Example #2
0
  void forEachFile(VisitorFunc visitor, const char* root)
  {
    if(root[0] == '\0')
    {
      if(visitor.directory("textures/", 1))
        return;
    }
    else if(strcmp(root, "textures/") != 0)
    {
      return;
    }

    for(files_t::iterator i = m_files.begin(); i != m_files.end(); ++i)
      visitor.file(i->first.c_str());
  }
Example #3
0
path::files_t files_by_prefix(std::string const& path) {
    using namespace details;
    files_t files;

    std::string folder(parent_path(path));
    std::string prefix = filename(path);

    files_t out_files;
    const files_t all_files = files_in_folder(folder);

    for (auto it = all_files.begin(); it != all_files.end(); ++it) // no std::copy_if before C++11
        if (boost::starts_with(filename(*it), prefix))
            out_files.push_back(*it);

    return out_files;
}
Example #4
0
  WadArchive(const char* name)
    : m_name(name), m_wadfile(name)
  {
    if(!m_wadfile.failed())
    {
      wadinfo_t wadinfo;
      istream_read_wadinfo(m_wadfile, wadinfo);

      EWadVersion version = wad_version(wadinfo.identification);
      int miptexType = miptex_type_for_version(version);

      if(version != eNotValid)
      {
        m_wadfile.seek(wadinfo.infotableofs);

        for(int i = 0; i < wadinfo.numlumps; ++i)
        {
          char buffer[32];
          lumpinfo_t lumpinfo;
          istream_read_lumpinfo(m_wadfile, lumpinfo);
          if(lumpinfo.type == miptexType)
          {
            strcpy(buffer, "textures/");
            strcat(buffer, lumpinfo.name);
            strcat(buffer, type_for_version(version));
            m_files.insert(files_t::value_type(buffer, wad_record_t(lumpinfo.filepos, lumpinfo.disksize, lumpinfo.size)));
          }
        }
      }
    }
  }
Example #5
0
 // if file doesn't exist in project, add it and return reference to it
 // otherwise return a reference to the existing file.
 file& add_file(std::string const& file_path) {
     return files_.insert(
         files_t::value_type(file_path, file())).first->second;
 }
Example #6
0
 bool containsFile(const char* name)
 {
   return m_files.find(name) != m_files.end();
 }