Go to the SVN repository for this file.
1 #ifndef UTIL___TEXT_JOINER__HPP 2 #define UTIL___TEXT_JOINER__HPP 59 template<
size_tnum_prealloc,
typenameTIn =
string,
60 typenameTOut = basic_string<typename TIn::value_type> >
76 template<
size_tnum_prealloc,
typenameTIn,
typenameTOut>
85 if(m_MainStorageUsage < num_prealloc) {
86m_MainStorage[m_MainStorageUsage++] = s;
87}
else if(m_ExtraStorage.get() !=
NULL) {
89 Warning<<
"exceeding anticipated count " 91m_ExtraStorage->push_back(s);
93m_ExtraStorage.reset(
newvector<TIn>(1, s));
100 template<
size_tnum_prealloc,
typenameTIn,
typenameTOut>
105 for(
size_t i= 0;
i< m_MainStorageUsage; ++
i) {
106size_needed += m_MainStorage[
i].size();
108 if(m_ExtraStorage.get() !=
NULL) {
109 ITERATE(
typenamevector<TIn>, it, *m_ExtraStorage) {
110size_needed += it->size();
115 result->reserve(size_needed);
116 for(
size_t i= 0;
i< m_MainStorageUsage; ++
i) {
119 if(m_ExtraStorage.get() !=
NULL) {
120 ITERATE(
typenamevector<TIn>, it, *m_ExtraStorage) {
121 result->append(it->data(), it->size());
CTextJoiner<> â template for efficiently collecting and joining strings.
Include a standard set of the NCBI C++ Toolkit most basic headers.
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
#define ERR_POST_XX_ONCE(error_name, err_subcode, message)
Error posting only once during program execution with given error code name and given error subcode.
void Warning(CExceptionArgs_Base &args)
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
NCBI_NS_STD::string::size_type SIZE_TYPE
CTextJoiner & Add(const TIn &s)
size_t m_MainStorageUsage
void Join(TOut *result) const
TIn m_MainStorage[num_prealloc]
unique_ptr< vector< TIn > > m_ExtraStorage
Definition of all error codes used in util (xutil.lib).
const struct ncbi::grid::netcache::search::fields::SIZE size
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4