text
stringlengths
0
2.2M
} break;
default: {
cerr << "WARNING: CASE `" << test << "' NOT FOUND." << endl;
testStatus = -1;
}
}
// CONCERN: In no case does memory come from the global allocator.
LOOP_ASSERT(globalAllocator.numBlocksTotal(),
0 == globalAllocator.numBlocksTotal());
if (testStatus > 0) {
cerr << "Error, non-zero test status = " << testStatus << "." << endl;
}
return testStatus;
}
// ----------------------------------------------------------------------------
// Copyright 2014 Bloomberg Finance L.P.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ----------------------------- END-OF-FILE ----------------------------------
// balxml_formatter_compactimpl.cpp -*-C++-*-
#include <balxml_formatter_compactimpl.h>
#include <bsls_ident.h>
BSLS_IDENT_RCSID(balxml_formatter_compactimpl_cpp,"$Id$ $CSID$")
#include <bsls_assert.h>
#include <bsl_algorithm.h>
namespace BloombergLP {
namespace balxml {
// -------------------------------
// class Formatter_CompactImplUtil
// -------------------------------
// PRIVATE CLASS METHODS
void Formatter_CompactImplUtil::addCommentImpl(
bsl::ostream& stream,
State *state,
const bsl::string_view& comment,
const bsl::string_view& openMarker,
const bsl::string_view& closeMarker)
{
// Step 1: Print a sequence of conditional tokens to 'stream' and update
// the column number and indentation level of 'state'.
if (StateId::e_IN_TAG == state->id()) {
stream << '>';
state->column() += 1;
}
stream << ' ' << openMarker << comment << closeMarker;
state->column() +=
1 + static_cast<int>(openMarker.length() + comment.length() +
closeMarker.length());
// Step 2: Update the ID of 'state'.
if (StateId::e_AT_START == state->id() ||
StateId::e_IN_TAG == state->id()) {
state->id() = StateId::e_FIRST_DATA_BETWEEN_TAGS;
}
}
// CLASS METHODS
bsl::ostream& Formatter_CompactImplUtil::addBlankLine(bsl::ostream& stream,
State *state)
{
// Step 1: Print a sequence of conditional tokens to 'stream' and update
// the column number and indentation level of 'state'.
if (StateId::e_IN_TAG == state->id()) {
stream << '>';
state->column() += 1;
}
if (0 < state->column()) {
stream << '\n';
state->column() = 0;
}
stream << '\n';