Teuchos - Trilinos Tools Package Version of the Day
Loading...
Searching...
No Matches
Teuchos_StringInputStream.cpp
1// @HEADER
2// *****************************************************************************
3// Teuchos: Common Tools Package
4//
5// Copyright 2004 NTESS and the Teuchos contributors.
6// SPDX-License-Identifier: BSD-3-Clause
7// *****************************************************************************
8// @HEADER
9
11
12using namespace Teuchos;
13
14
15unsigned int StringInputStream::readBytes(unsigned char* const toFill,
16 const unsigned int maxToRead)
17{
18 if (pos_ == text_.length()) return 0;
19
20 int toRead = static_cast<int>(text_.length() - pos_);
21 if ((int) maxToRead < toRead) toRead = maxToRead;
22
23 std::strncpy((char*) toFill, text_.c_str()+pos_, toRead);
24
25 pos_ += toRead;
26
27 return (size_t) toRead;
28}
29
Definition of XMLInputStream derived class for reading XML from a std::string.
Smart reference counting pointer class for automatic garbage collection.
virtual unsigned int readBytes(unsigned char *const toFill, const unsigned int maxToRead)
Read up to maxToRead bytes.
The Teuchos namespace contains all of the classes, structs and enums used by Teuchos,...