Разработка программного модуля для компьютерной игры
Дипломная работа - Компьютеры, программирование
Другие дипломы по предмету Компьютеры, программирование
ащий уникальный идентификатор
и указатель на поток ostream.
*/o_file
{_id m_id;::auto_ptr stream)
: m_id(id), m_stream(stream) {}
~o_file() {}
/// Возвращает ссылку на уникальный идентификатор
const file_id &id() const { return m_id; }
/// Возвращает ссылку на поток::ostream &stream() const { return *m_stream; }
};
//=====================================================================================//
// class i_file //
//=====================================================================================//
/** \class i_file
\brief Класс - "файл для чтения".
*/
/**Класс, содержащий уникальный идентификатор
и указатель на поток istream.
*/i_file
{_id m_id;::auto_ptr stream)
: m_id(id), m_stream(stream) {}
~i_file() {}
/// Возвращает ссылку на уникальный идентификатор
const file_id &id() const { return m_id; }
/// Возвращает ссылку на поток::istream &stream() const { return *m_stream; }
};
}
}
Файл fs_path.hmll
{fs
{
//=====================================================================================//
// class fs_path //
//=====================================================================================//
/*Служебный класс, призван заменить строку-путь.
При конструировании разбивает строку по слэшам и заносит
в список имена каталогов. Может "превращаться" обратно в строку.
*/FILE_SYSTEM_EXPORT fs_path
{:const_iterator;std::list separators_t;///<позиции, по которым в m_data находятся слеши (считается, чтоо в конце строки тоже есть слеш - для удобства)std::string data_t;:_t m_data;_t m_separators;:_path();_path(const std::string& data);_path(const char* data);_path(const fs_path& another);
~fs_path() {}:_iterator begin() const;_iterator end() const;::string front() const;::string back() const;pop_front();pop_back();length() const;clear();std::string& to_str() const;:_path& operator+=(const fs_path& another);_path& operator=(const fs_path& another);:analyzeRawData();
};
//=====================================================================================//
// fs_path operator+(); //
//=====================================================================================//_path operator+(const fs_path& first, const fs_path& second);
//=====================================================================================//
// class fs_path::const_iterator //
//=====================================================================================//FILE_SYSTEM_EXPORT_path::const_iterator: public std::iterator
{:fs_path;::string m_selecting;fs_path::data_t* m_data;fs_path::separators_t* m_separators;m_dataIndex;///<"from" point in controlled sequence_path::separators_t::const_iterator m_sepIt;///<next separator:_iterator();_iterator(const const_iterator& another);
~const_iterator();:operator==(const const_iterator& another) const
{ return ((m_dataIndex == another.m_dataIndex) && (m_sepIt == another.m_sepIt)); }operator!=(const const_iterator& another) const
{ return ((m_dataIndex != another.m_dataIndex) || (m_sepIt != another.m_sepIt)); }_iterator& operator++();_iterator operator++(int);_iterator& operator--();_iterator operator--(int);std::string& operator*() const;std::string* operator->() const;_iterator& operator=(const const_iterator& another);
};
}
}
Файл cache.hmll
{fs
{
//=====================================================================================//
// class cache //
//=====================================================================================//FILE_SYSTEM_EXPORT cache
{:std::deque single_query_cache_t;_query_cache_t m_single_query_data;://кэширование данных
///добавить данные последнего запроса на операцию с одним файлом (r_open, w_open, exists)
void add_single_query(file_id id);
///файл удаляется, нужно сбросить его из всех кэшей
void drop_file(file_id id);
///сбросить все кэши (например, обновилась структура подсистем)
void clear_all();://получение данных
/// посмотреть наличие в кэше id, полученного ранее по такому же пути
file_id single_query_stored(const std::string& path);
};
}
}