root/OpenSceneGraph/trunk/src/osgPlugins/OpenFlight/DataOutputStream.h @ 13041

Revision 13041, 2.2 kB (checked in by robert, 3 years ago)

Ran script to remove trailing spaces and tabs

  • Property svn:eol-style set to native
Line 
1/*
2 * This library is open source and may be redistributed and/or modified under
3 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or (at
4 * your option) any later version. The full license is in the LICENSE file
5 * included with this distribution, and on the openscenegraph.org website.
6 *
7 * This library is distributed in the hope that it will be useful, but
8 * WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * OpenSceneGraph Public License for more details.
11*/
12
13//
14// Copyright(c) 2008 Skew Matrix Software LLC.
15//
16
17#ifndef __FLTEXP_DATA_OUTPUT_STREAM_H__
18#define __FLTEXP_DATA_OUTPUT_STREAM_H__ 1
19
20
21#include <ostream>
22#include <string>
23#include <osg/Vec3f>
24#include <osg/Vec3d>
25#include <osg/Vec4f>
26#include "Types.h"
27//#include "Export.h"
28
29
30namespace flt {
31
32
33class Record;
34
35class DataOutputStream : public std::ostream
36{
37public:
38    explicit DataOutputStream( std::streambuf* sb, bool validate=false );
39
40    void writeInt8( const int8 val );
41    void writeUInt8( const uint8 val );
42    void writeInt16( const int16 val );
43    void writeUInt16( const uint16 val );
44    void writeInt32( const int32 val );
45    void writeUInt32( const uint32 val );
46    void writeFloat32( const float32 val );
47    void writeFloat64( const float64 val );
48
49    // Write the entire string. If nullTerminate is true, write an additional NULL.
50    // Always writes either 'val.size()' bytes or 'val.size()+1' bytes.
51    void writeString( const std::string& val, bool nullTerminate=true );
52
53    // Never write more than 'size-1' bytes from 'val', and write 'fill' so that 'size' bytes total are written.
54    // Always writes 'size' bytes..
55    void writeString( const std::string& val, int size, char fill='\0' );
56
57    void writeID( const std::string& val );
58    void writeVec2f( const osg::Vec2f& val );
59    void writeVec3f( const osg::Vec3f& val );
60    void writeVec4f( const osg::Vec4f& val );
61    void writeVec3d( const osg::Vec3d& val );
62
63    void writeFill( int sizeBytes, const char val='\0' );
64
65protected:
66    virtual std::ostream& vwrite( char_type* str, std::streamsize count );
67
68    bool _byteswap;
69    bool _validate;
70
71    static char _null;
72};
73
74}
75
76#endif
Note: See TracBrowser for help on using the browser.