FDO API Reference Feature Data Objects

TextWriter.h

Go to the documentation of this file.
00001 #ifndef FDO_IO_TEXTWRITER_H
00002 #define FDO_IO_TEXTWRITER_H
00003 // 
00004 
00005 //
00006 // Copyright (C) 2004-2006  Autodesk, Inc.
00007 // 
00008 // This library is free software; you can redistribute it and/or
00009 // modify it under the terms of version 2.1 of the GNU Lesser
00010 // General Public License as published by the Free Software Foundation.
00011 // 
00012 // This library is distributed in the hope that it will be useful,
00013 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015 // Lesser General Public License for more details.
00016 // 
00017 // You should have received a copy of the GNU Lesser General Public
00018 // License along with this library; if not, write to the Free Software
00019 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00020 //
00021 
00022 #include <FdoCommon.h>
00023 
00024 /// \brief
00025 /// FdoIoTextWriter writes Unicode wide character text to a binary stream.
00026 /// The text is written in UTF8 format.
00027 class FdoIoTextWriter : public FdoDisposable
00028 {
00029 public:
00030     /// \brief
00031     /// Constructs a text writer on a file.
00032     /// 
00033     /// \param fileName 
00034     /// Input name of the file to write to. The file is created
00035     /// if it does not yet exist. If it already exists, its previous contents are 
00036     /// completely overwritten.
00037     /// 
00038     /// \return
00039     /// Returns FdoIoTextWriter
00040     /// 
00041     FDO_API_COMMON static FdoIoTextWriter* Create( FdoString* fileName );
00042 
00043     /// \brief
00044     /// Constructs a text writer on a stream.
00045     /// 
00046     /// \param stream 
00047     /// Input the stream to write to. Writing starts at the 
00048     /// stream's current position.
00049     /// 
00050     /// \return
00051     /// Returns FdoIoTextWriter
00052     /// 
00053     FDO_API_COMMON static FdoIoTextWriter* Create( FdoIoStream* stream );
00054     
00055     /// \brief
00056     /// Gets the underlying stream. If a stream was passed to this object
00057     /// then this stream is returned.
00058     /// Otherwise, an auto-generated stream (wrapped around the  file name 
00059     /// that was passed to this object) is returned.
00060     /// 
00061     /// \return
00062     /// Returns the underlying stream.
00063     /// 
00064     FDO_API_COMMON FdoIoStream* GetStream();
00065 
00066     /// \brief
00067     /// Writes to this text writer. The text is written in UTF8 format.
00068     /// 
00069     /// \param string 
00070     /// The text to write.
00071     /// 
00072     FDO_API_COMMON void Write( FdoString* string );
00073 
00074     /// \brief
00075     /// Same as Write(), except that a carriage return (n) is appended to
00076     /// the text.
00077     /// 
00078     /// \param string 
00079     /// The text to write.
00080     /// 
00081     FDO_API_COMMON void WriteLine( FdoString* string );
00082 
00083 protected:
00084 /// \cond DOXYGEN-IGNORE
00085     FdoIoTextWriter() {}
00086     FdoIoTextWriter( FdoIoStream* stream );
00087     virtual ~FdoIoTextWriter(void);
00088 /// \endcond
00089 
00090 private:
00091     /// The underlying stream.
00092     FdoIoStreamP mStream;
00093 };
00094 
00095 /// \brief
00096 /// FdoIoTextWriterP is a FdoPtr on FdoIoTextWriter, provided for convenience.
00097 typedef FdoPtr<FdoIoTextWriter> FdoIoTextWriterP;
00098 
00099 #endif
00100 
00101 

Comments or suggestions? Send us feedback.