- acf-02.zip
- Acf
- docs
- lib
- samples
- Corlib
- Arrays
- Boxing
- Delegate
- Environment
- Event
- FileSystem
- Foreach
- MFCReadWrite
- ReadWrite
- Samples.sln
- Samples.txt
- Strings
- Threads
- Timer
- src
- Corlib
- Pal
- tools
- vcide
- AppWizards
- ConsoleApp
- ConsoleApp.txt
- VCProjects
- ACF
- AcfAppWiz.vsdir
- AcfAppWiz.ico
- AcfAppWiz.vsdir
- AcfAppWiz.vsz
- VCWizards
- AcfAppWiz
- Scripts
- 1033
- Templates
- 1033
- readme.txt
- usertype.dat
- acf-01.zip
|
//---------------------------------------------------------------------
//
// Copyright (C) 2004 Yingle Jia
//
// Permission to copy, use, modify, sell and distribute this software is
// granted provided this copyright notice appears in all copies.
// This software is provided "as is" without express or implied warranty,
// and with no claim as to its suitability for any purpose.
//
#include "stdafx.h"
namespace Acf {
namespace IO {
// Constructors
StringWriter::StringWriter(StringBuilder* sb)
{
this->_sb = (sb != null) ? sb : new StringBuilder();
}
// Destructor
/*virtual*/ StringWriter::~StringWriter()
{
Close();
}
// Properties
/*override*/ EncodingPtr StringWriter::get_Encoding()
{
if (this->_encoding == null)
this->_encoding = new UnicodeEncoding(false, false);
return this->_encoding;
}
// Methods
/*virtual*/ StringBuilderPtr StringWriter::GetStringBuilder()
{
return this->_sb;
}
/*override*/ StringPtr StringWriter::ToString()
{
return this->_sb->ToString();
}
/*override*/ void StringWriter::Write(wchar_t value)
{
if (!_isOpen)
throw InvalidOperationException();
this->_sb->Append(value);
}
/*override*/ void StringWriter::Write(Array<wchar_t>* buffer, int index, int count)
{
Acf::VerifyArrayRange(buffer, index, count);
if (!this->_isOpen)
throw InvalidOperationException();
this->_sb->Append(buffer, index, count);
}
/*override*/ void StringWriter::Write(String* value)
{
if (!this->_isOpen)
throw InvalidOperationException();
if (value != null)
this->_sb->Append(value);
}
/*override*/ void StringWriter::Close()
{
this->_isOpen = false;
}
} // namespace IO
} // namespace Acf
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here
Yingle Jia is a software engineer located in Beijing, China. He currently works at IBM CSDL (China Software Development Lab). His interests include C++/COM/C#/.NET/XML, etc. He likes coding and writing.
He is the creator of ACF (Another C++ Framework) project. See
http://acfproj.sourceforge.net/.
He also has a blog at
http://blogs.wwwcoder.com/yljia/