mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 23:10:05 +00:00
Initial placefile parsing
This commit is contained in:
parent
7c863793ea
commit
88475f5b0e
6 changed files with 569 additions and 0 deletions
21
wxdata/include/scwx/gr/color.hpp
Normal file
21
wxdata/include/scwx/gr/color.hpp
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
#pragma once
|
||||
|
||||
#include <scwx/gr/gr_types.hpp>
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <boost/gil/typedefs.hpp>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace gr
|
||||
{
|
||||
|
||||
boost::gil::rgba8_pixel_t ParseColor(const std::vector<std::string>& tokenList,
|
||||
std::size_t startIndex,
|
||||
ColorMode colorMode,
|
||||
bool hasAlpha = true);
|
||||
|
||||
} // namespace gr
|
||||
} // namespace scwx
|
||||
15
wxdata/include/scwx/gr/gr_types.hpp
Normal file
15
wxdata/include/scwx/gr/gr_types.hpp
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
#pragma once
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace gr
|
||||
{
|
||||
|
||||
enum class ColorMode
|
||||
{
|
||||
RGBA,
|
||||
HSLuv
|
||||
};
|
||||
|
||||
} // namespace gr
|
||||
} // namespace scwx
|
||||
47
wxdata/include/scwx/gr/placefile.hpp
Normal file
47
wxdata/include/scwx/gr/placefile.hpp
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
#pragma once
|
||||
|
||||
#include <istream>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <boost/gil/typedefs.hpp>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace gr
|
||||
{
|
||||
|
||||
/**
|
||||
* @brief Place File
|
||||
*
|
||||
* Implementation based on:
|
||||
* Place File Specification
|
||||
* Mike Gibson
|
||||
* Gibson Ridge Software, LLC. Used with permission.
|
||||
* http://www.grlevelx.com/manuals/gis/files_places.htm
|
||||
*/
|
||||
class Placefile
|
||||
{
|
||||
public:
|
||||
explicit Placefile();
|
||||
~Placefile();
|
||||
|
||||
Placefile(const Placefile&) = delete;
|
||||
Placefile& operator=(const Placefile&) = delete;
|
||||
|
||||
Placefile(Placefile&&) noexcept;
|
||||
Placefile& operator=(Placefile&&) noexcept;
|
||||
|
||||
bool IsValid() const;
|
||||
|
||||
static std::shared_ptr<Placefile> Load(const std::string& filename);
|
||||
static std::shared_ptr<Placefile> Load(std::istream& is);
|
||||
|
||||
private:
|
||||
class Impl;
|
||||
std::unique_ptr<Impl> p;
|
||||
};
|
||||
|
||||
} // namespace common
|
||||
} // namespace scwx
|
||||
Loading…
Add table
Add a link
Reference in a new issue