Teuchos Package Browser (Single Doxygen Collection)
Version of the Day
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
parameterlist
src
Teuchos_StringInputStream.cpp
Go to the documentation of this file.
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
10
#include "
Teuchos_StringInputStream.hpp
"
11
12
using namespace
Teuchos;
13
14
15
unsigned
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
Teuchos::StringInputStream::text_
std::string text_
Definition:
Teuchos_StringInputStream.hpp:48
Teuchos::StringInputStream::pos_
unsigned int pos_
Definition:
Teuchos_StringInputStream.hpp:49
Teuchos::StringInputStream::readBytes
virtual unsigned int readBytes(unsigned char *const toFill, const unsigned int maxToRead)
Read up to maxToRead bytes.
Definition:
Teuchos_StringInputStream.cpp:15
Teuchos_StringInputStream.hpp
Definition of XMLInputStream derived class for reading XML from a std::string.
Generated on Thu Nov 21 2024 09:21:40 for Teuchos Package Browser (Single Doxygen Collection) by
1.8.5