1 #ifndef MESH_IO_BINARY_H_INCLUDED
2 #define MESH_IO_BINARY_H_INCLUDED
12 *
\83f
\81[
\83^
\93Ç
\82Ý
\8d\9e\82Ý
\83C
\83\93\83^
\81[
\83t
\83F
\81[
\83X
18 virtual unsigned int read(char *buf, unsigned int size)=0;
19 virtual unsigned int getPos()const=0;
20 virtual bool isEnd()const=0;
25 if(read(reinterpret_cast<char*>(&t), sizeof(t))){
35 return get(byte) ? byte : 0;
37 std::string getString(unsigned int length, bool isTrim=false)
39 std::vector<char> buf(length);
40 read(&buf[0], buf.size());
42 std::vector<char>::iterator it;
45 for(; it!=buf.end(); ++it){
54 return std::string(buf.begin(), it);
56 unsigned char getUchar()
59 return get(value) ? value : 0;
61 unsigned short getUshort()
64 return get(value) ? value : 0;
66 unsigned int getUint()
69 return get(value) ? value : 0;
74 *
\83t
\83@
\83C
\83\8b\82©
\82ç
\82Ì
\93Ç
\82Ý
\8d\9e\82Ý
76 class FileReader : public IReader
83 FileReader(const char *path);
84 virtual ~FileReader();
85 virtual unsigned int read(char *buf, unsigned int size);
86 virtual unsigned int getPos()const;
87 virtual bool isEnd()const;
91 *
\83\81\83\82\83\8a\82©
\82ç
\82Ì
\93Ç
\82Ý
\8d\9e\82Ý
93 class MemoryReader : public IReader
100 MemoryReader(const char *buf, unsigned int size);
101 virtual ~MemoryReader();
102 virtual unsigned int read(char *buf, unsigned int size);
103 virtual unsigned int getPos()const;
104 virtual bool isEnd()const;
107 void readAll(const char *path, std::vector<char> &all);
109 } // namespace binary
110 } // namespace meshio
112 #endif // MESH_IO_BINARY_H_INCLUDED