📄 byteorderdatainstream.inl
字号:
/********************************************************************** * $Id: ByteOrderDataInStream.inl 1997 2007-08-22 23:45:12Z mloskot $ * * GEOS - Geometry Engine Open Source * http://geos.refractions.net * * Copyright (C) 2005-2006 Refractions Research Inc. * Copyright (C) 2001-2002 Vivid Solutions Inc. * * This is free software; you can redistribute and/or modify it under * the terms of the GNU Lesser General Public Licence as published * by the Free Software Foundation. * See the COPYING file for more information. * **********************************************************************/#ifndef GEOS_IO_BYTEORDERDATAINSTREAM_INL#define GEOS_IO_BYTEORDERDATAINSTREAM_INL#include <geos/io/ParseException.h>#include <geos/io/ByteOrderDataInStream.h>#include <geos/io/ByteOrderValues.h>#include <geos/platform.h> // for getMachineByteOrder#include <iostream> // ostream, istream namespace geos {namespace io {INLINEByteOrderDataInStream::ByteOrderDataInStream(std::istream *s) : byteOrder(getMachineByteOrder()), stream(s){}INLINEByteOrderDataInStream::~ByteOrderDataInStream(){}INLINE void ByteOrderDataInStream::setInStream(std::istream *s){ stream=s;}INLINE voidByteOrderDataInStream::setOrder(int order){ byteOrder=order;}INLINE unsigned charByteOrderDataInStream::readByte() // throws ParseException{ stream->read(reinterpret_cast<char *>(buf), 1); if ( stream->eof() ) throw ParseException("Unexpected EOF parsing WKB"); return buf[0];}INLINE intByteOrderDataInStream::readInt() { stream->read(reinterpret_cast<char *>(buf), 4); if ( stream->eof() ) throw ParseException("Unexpected EOF parsing WKB"); return ByteOrderValues::getInt(buf, byteOrder);}INLINE longByteOrderDataInStream::readLong() { stream->read(reinterpret_cast<char *>(buf), 8); if ( stream->eof() ) throw ParseException("Unexpected EOF parsing WKB"); return static_cast<long>(ByteOrderValues::getLong(buf, byteOrder));}INLINE doubleByteOrderDataInStream::readDouble() { stream->read(reinterpret_cast<char *>(buf), 8); if ( stream->eof() ) throw ParseException("Unexpected EOF parsing WKB"); return ByteOrderValues::getDouble(buf, byteOrder);}} // namespace io} // namespace geos#endif // #ifndef GEOS_IO_BYTEORDERDATAINSTREAM_INL/********************************************************************** * $Log$ * Revision 1.1 2006/03/28 11:26:13 strk * ByteOrderDataInStream inlines moved to .inl file, updated * implementation files includes. * **********************************************************************/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -