bool ossimKeywordlist::write(const char* file, const char* comment) const { std::ofstream filename(file); if (!filename) { ossimNotify(ossimNotifyLevel_WARN) <<"ossimKeywordlist::write, Error opening file: " << file << std::endl; return false; } if ( comment != 0 ) { ossimString commentStr("// "); commentStr += comment; // Write out the input comment to the first line. filename << commentStr.c_str() << std::endl; } writeToStream(filename); filename.close(); return true; }
bool IniFormatter::writeToStream(const Node* root, Stream* stream, unsigned int tcount, unsigned int nameformat, unsigned int varformat) { if (root && stream) { UnicodeString temp; if (root->getParent() && root->getName().length()>0) { // cheap way of saying the node is not a root node writeTabs(stream, tcount, false); root->getNameFormatted(temp, nameformat); stream->writeChar16('['); temp.append(']'); stream->writeLine(temp); } Node* node; ValueVariable* value; for (VarList::const_iterator iter=root->begin(); iter!=root->end(); ++iter) { value=dynamic_cast<ValueVariable*>(*iter); node=dynamic_cast<Node*>(*iter); if (node) { writeToStream(node, stream, tcount, nameformat, varformat); } else if (value) { if (formatValue(*value, temp, nameformat, varformat)) { writeTabs(stream, tcount, false); stream->writeLine(temp); } } } return true; } return false; }
void Screen::writeSelectionToStream(TerminalCharacterDecoder* decoder , bool preserveLineBreaks) const { if (!isSelectionValid()) return; writeToStream(decoder,selTopLeft,selBottomRight,preserveLineBreaks); }
bool IniFormatter::writeToFile(const Node* root, const char* path, const char* encoding, unsigned int nameformat, unsigned int varformat) { Stream* stream=FileStream::writeFile(path, encoding); if (stream) { writeToStream(root, stream, 0, nameformat, varformat); stream->close(); return true; } return false; }
bool CSVFormatter::writeToFile(const CSVMap* map, const char* path, UChar32 sepchar, const char* encoding, unsigned int varformat) { Stream* stream=FileStream::writeFile(path, encoding); if (stream) { writeToStream(map, stream, sepchar, varformat); stream->close(); return true; } return false; }
std::ostream &usvfs::log::operator<<(std::ostream &os, const Wrap<LPCWSTR> &str) { try { writeToStream(os, str.data()); } catch (const std::exception &e) { os << e.what(); } return os; }
void WordXML::saveToFile(QString aFileName) { QFile aFile(aFileName); aFile.open(QIODevice::WriteOnly); QTextStream aStream(&aFile); aStream.setCodec("UTF-8"); writeToStream(aStream); }
void Reporter::blank ( void ) { // must be initialised and activated if ( ( state & CPO_CONNECTED ) && ( state & CPO_ACTIVATED ) ) { EnterCriticalSection(&aCriticalSection); writeToStream ( " " ); LeaveCriticalSection(&aCriticalSection); } }
void Value::writeToFile(const std::string &filePath, bool indent, bool escapeAll) const { std::ofstream file; file.open(filePath.c_str()); if (file.is_open()) { writeToStream(file, indent, escapeAll); file.close(); } else { std::cout << "Failed to open file to write the json into: " << filePath << std::endl; } }
//******************************************************************* // Public Method: //******************************************************************* std::ostream& ossimKeywordlist::print(std::ostream& os) const { writeToStream(os); #if 0 KeywordMap::const_iterator i; for(i = m_map.begin(); i != m_map.end(); ++i) { os << (*i).first << delimiter_str().c_str() << " " << (*i).second << std::endl; } #endif return os; }
/** * return all payload as String (may need lot of ram or trigger out of memory!) * @return String */ String HTTPClient::getString(void) { StreamString sstring; if(_size) { // try to reserve needed memmory if(!sstring.reserve((_size + 1))) { DEBUG_HTTPCLIENT("[HTTP-Client][getString] too less memory to reserve as string! need: %d\n", (_size + 1)); return String("--too less memory--"); } } writeToStream(&sstring); return sstring; }
bool SerializerNew::serializeToStream(const Variant& v, IDataStream* stream, SerializationFormat format) { if (stream == nullptr) return false; auto doc = getDocument(format); serializeToDocument(v, doc.get()); // Write to the stream bool success = doc->writeToStream(stream); success = stream->sync() && success; stream->seek(0, std::ios_base::beg); return success; }
void CMlpMapping::writeParamsToStream(ostream& out) const { writeToStream(out, "baseType", getBaseType()); writeToStream(out, "type", getType()); writeToStream(out, "numData", getNumData()); writeToStream(out, "outputDim", getOutputDim()); writeToStream(out, "inputDim", getInputDim()); writeToStream(out, "hiddenDim", hiddenDim); writeToStream(out, "numParams", getOptNumParams()); CMatrix par(1, getOptNumParams()); getOptParams(par); par.toStream(out); }
void ossimKeywordlist::toString(ossimString& result)const { std::ostringstream out; writeToStream(out); result = out.str(); #if 0 KeywordMap::const_iterator i; for(i = m_map.begin(); i != m_map.end(); i++) { result += (*i).first; result += delimiter_str().c_str(); result += " "; result += (*i).second; result += '\n'; } #endif }
void ColormapArchiver::doArchive(const BaseContainer& in, const Context&, OutputLumpData& out) const { const ColormapContainer &data = dynamic_cast<const ColormapContainer &>(in); if (data.mapset.size() != colormaps_number_) warning("Wrong number of map lines"); for (const auto &map_it : data.mapset) { if (map_it.size() != colors_per_map_) error("Wrong number of colors in a map line. Probably conversion settings are incorrect"); //todo: specify line assert(doEstimateSize(in) > 0); //we shouldn't be here if input is invalid for (const auto &color_it : map_it) { assert(0 <= color_it && color_it <= 0xff); writeToStream(out.stream, color_it & 0xff); } } out.palettes[palette_name_] = data.palette; }
std::string Value::toString() const { std::ostringstream OSS; writeToStream(OSS); return OSS.str(); }
void Screen::writeLinesToStream(TerminalCharacterDecoder* decoder, int fromLine, int toLine) const { writeToStream(decoder,loc(0,fromLine),loc(columns-1,toLine)); }
void RoNetPacket::tryWriteToStream(RoDataStream& stream) const { roTRY writeToStream(stream); roCATCH_EXCEPTIONS_AND_EXIT }