bool UtlXMLStream::readAttribute(std::string& sName, bool& bValue) { skipBlanks( getInputStream() ); if (!readName(sName)) return false; if (!readBeginningOfAttribute()) return false; std::string sXMLText; if (!readString( getInputStream() , sXMLText)) return false; if (stricmp(sXMLText.c_str(),"TRUE")) bValue=true; if (stricmp(sXMLText.c_str(),"FALSE")) bValue=false; else return false; if (!readEndOfAttribute()) return false; return true; }
bool UtlXMLStream::readEndTag(std::string& sTag) { int iChar; skipBlanks( getInputStream() ); iChar=readChar( getInputStream() ); if (iChar != '<') { return false; } iChar=readChar( getInputStream() ); if (iChar != '/') { return false; } if (!readWord( getInputStream(), sTag )) return false; iChar=readChar( getInputStream() ); if (iChar != '>') { return false; } return true; }
bool UtlXMLStream::readKeyOfHashTable(std::string& sKey) { int iChar; skipBlanks( getInputStream() ); iChar=readChar( getInputStream() ); if (iChar != '<') { return false; } std::string sTrash; if (!readString( getInputStream() , sTrash)) return false; if (strcmp(sTrash.c_str(),"pair")) return false; std::string sKeyTag; if (!readAttribute( sKeyTag , sKey)) return false; if (strcmp(sKeyTag.c_str(),"key")) return false; return true; }
bool UtlXMLStream::readBeginOfArrayElement(std::string sType) { int iChar; skipBlanks( getInputStream() ); iChar=readChar( getInputStream() ); if (iChar != '<') { return false; } std::string sReadType; if (!readString( getInputStream(), sReadType)) if (sReadType!=sType) return false; std::string sValue; if (!readString( getInputStream(), sValue)) return false; iChar=readChar( getInputStream() ); if (iChar != ' ') { return false; } if (strcmp(sValue.c_str(),"value") ) return false; return true; }
bool UtlXMLStream::readAttribute(std::string& sName, std::string& sValue) { skipBlanks( getInputStream() ); if (!readName(sName)) return false; // if (!readBeginningOfAttribute()) // return false; // std::string sXMLText; // if (!readName( sXMLText)) // return false; int iChar=readChar( getInputStream() ); if (iChar != '=') { return false; } std::string sXMLText; if (!readString( getInputStream(), sXMLText)) return false; sValue=convertXMLTextToClassicText( sXMLText ); // if (!readEndOfAttribute()) // return false; return true; }
bool UtlXMLStream::readEndOfAssociation(std::string& sOwnerClass, std::string& sName) { int iChar; skipBlanks( getInputStream() ); iChar=readChar( getInputStream() ); if (iChar != '<') { return false; } iChar=readChar( getInputStream() ); if (iChar != '/') { return false; } // Read a string, search '_' and split the string in two std::string sCompletWord,sDebut,sFin; if (!readWord( getInputStream(), sCompletWord )) return false; if (!splitString( sCompletWord, '_', sOwnerClass, sName)) return false; iChar=readChar( getInputStream() ); if (iChar != '>') { return false; } return true; }
bool UtlXMLStream::readEndOfAttributes() { int iChar; skipBlanks( getInputStream() ); iChar=readChar( getInputStream() ); if (iChar != '>') { return false; } return true; }
bool UtlXMLStream::readName(std::string& sName) { skipBlanks( getInputStream() ); std::string sNonNormaliseName; if (!readWord( getInputStream(), sNonNormaliseName )) return false; sName = normalizeAttributeName(sNonNormaliseName); return true; }
bool UtlXMLStream::readArrayElement(int& iValue) { skipBlanks( getInputStream() ); if (!readBeginOfArrayElement("int")) return false; if (!readInt( getInputStream() , iValue)) return false; if (!readEndOfArrayElement()) return false; return true; }
bool UtlXMLStream::readArrayElement(double& dValue) { skipBlanks( getInputStream() ); if (!readBeginOfArrayElement("double")) return false; if (!readDouble( getInputStream() , dValue)) return false; if (!readEndOfArrayElement()) return false; return true; }
bool UtlXMLStream::readArrayElement(UtlDate& myValue) { skipBlanks( getInputStream() ); if (!readBeginOfArrayElement("date")) return false; struct tm tmValue; if (!readDate( getInputStream() , tmValue)) return false; myValue=UtlDate( tmValue.tm_year, tmValue.tm_mon, tmValue.tm_mday, 0, 0, 0); if (!readEndOfArrayElement()) return false; return true; }
bool UtlXMLStream::readEndOfArrayElement() { int iChar; skipBlanks( getInputStream() ); iChar=readChar( getInputStream() ); if (iChar != '/') { return false; } iChar=readChar( getInputStream() ); if (iChar != '>') { return false; } return true; }
void IppURLConnection::getContent() { if (connected) { if (getResponseCode() == HTTP_OK && is_contenttype_ipp(getContentType())) { istream &is = getInputStream(); is >> *__ippResponse; } else {
bool UtlXMLStream::readBeginningOfObject(std::string& sTypeName) { int iChar; skipBlanks( getInputStream() ); iChar=readChar( getInputStream() ); if (iChar != '<') { return false; } if (!readWord( getInputStream(), sTypeName )) return false; return true; }
bool UtlXMLStream::readAttribute(std::string& sName, double& dValue) { skipBlanks( getInputStream() ); if (!readName(sName)) return false; if (!readBeginningOfAttribute()) return false; if (!readDouble( getInputStream() , dValue)) return false; if (!readEndOfAttribute()) return false; return true; }
/** * Redirect to debug output Stream for SIMULATION_MODE */ bool redirectDriverToCompositeOutputStream() { InputStream* inputStream = getInputStream(getDriverRequestBuffer()); // Redirect to debug OutputStream copyInputToOutputStream(inputStream, &(driverToI2CSlaveAndDebugCompositeOutputStream.outputStream), NULL, COPY_ALL); return true; }
bool UtlXMLStream::readArrayElement(std::string& sValue) { skipBlanks( getInputStream() ); if (!readBeginOfArrayElement("string")) return false; std::string sXMLText; if (!readString( getInputStream() , sXMLText)) return false; sValue=convertXMLTextToClassicText( sXMLText ); if (!readEndOfArrayElement()) return false; return true; }
jbool JConnection::readOk(){ getInputStream(); jbyte okByte=in->readByte(); if (okByte!= JTransportConfiguration::MSG_TYPE_OK){ return false; } return true; }
bool UtlXMLStream::readBeginningOfAttribute() { int iChar; skipBlanks( getInputStream() ); iChar=readChar( getInputStream() ); if (iChar != '=') { return false; } iChar=readChar( getInputStream() ); if (iChar != '\"') { return false; } return true; }
bool UtlXMLStream::readHashtableEntry(std::string& sKey, std::vector<double>& listOfValues) { int iChar; skipBlanks( getInputStream() ); if (!readKeyOfHashTable(sKey)) return false; iChar=readChar( getInputStream() ); if (iChar != ' ') { return false; } iChar=readChar( getInputStream() ); if (iChar != '>') { return false; } bool bAtLeastOne=false; bool bContinue=true; listOfValues.clear(); while (bContinue) { double dValue; int iPos = getInputStream().tellg(); bContinue=readArrayElement(dValue); if (bContinue) { listOfValues.push_back(dValue); bAtLeastOne=true; } else { getInputStream().seekg(iPos); } } if (!bAtLeastOne) { return false; } if (!readEndOfHashTable()) return false; return true; }
void eepromMemoryWriteBlock(Eeprom* eeprom_, unsigned long index, unsigned int length, Buffer* buffer) { // Find a better implementation unsigned long i; for (i = index; i < index + length; i++) { InputStream* inputStream = getInputStream(buffer); char value = readBinaryChar(inputStream); eeprom_->eepromWriteChar(eeprom_, i, value); } }
bool UtlXMLStream::readHashtableEntry(std::string& sKey, double& dValue) { int iChar; skipBlanks( getInputStream() ); if (!readKeyOfHashTable(sKey)) return false; iChar=readChar( getInputStream() ); if (iChar != '>') { return false; } std::string sValueTag; if (!readAttribute( sValueTag , dValue)) return false; if (!readEndOfHashTable()) return false; return true; }
bool UtlXMLStream::readAttribute(std::string& sName, UtlDate& myValue) { skipBlanks( getInputStream() ); if (!readName(sName)) return false; if (!readBeginningOfAttribute()) return false; struct tm tmValue; if (!readDate( getInputStream() , tmValue)) return false; myValue=UtlDate( tmValue.tm_year, tmValue.tm_mon, tmValue.tm_mday, 0, 0, 0); if (!readEndOfAttribute()) return false; return true; }
void ResourceManager::writeToFile(Error& error, const UTF16& sRezPath, const Path& destFile) { HInputStream in = getInputStream(sRezPath); HOutputStream out = NewObject(FileOutputStream, error, destFile, FileOutputStream::eOverwrite); if (error) return; in->pipe(error, out); if (error) return; }
bool UtlXMLStream::readArrayElement(bool& bValue) { skipBlanks( getInputStream() ); if (!readBeginOfArrayElement("bool")) return false; std::string sXMLText; if (!readString( getInputStream() , sXMLText)) return false; if (stricmp(sXMLText.c_str(),"TRUE")) bValue=true; if (stricmp(sXMLText.c_str(),"FALSE")) bValue=false; else return false; if (!readEndOfArrayElement()) return false; return true; }
bool UtlXMLStream::readObjectReference(std::string& sTypeName, std::string& sIDAttrName, std::string& sIdentifier) { int iChar; skipBlanks( getInputStream() ); iChar=readChar( getInputStream() ); if (iChar != '<') { return false; } std::string sTrash; // reference if (!readString( getInputStream(), sTrash)) return false; if (strcmp(sTrash.c_str(),"reference")) return false; // type if (!readAttribute(sTrash, sTypeName)) return false; // ID if (!readAttribute( sIDAttrName, sIdentifier)) return false; iChar=readChar( getInputStream() ); if (iChar != '/') { return false; } iChar=readChar( getInputStream() ); if (iChar != '>') { return false; } return true; }
std::wstring CommonToken::getText() { if (text != L"") { return text; } CharStream *input = getInputStream(); if (input == nullptr) { return L""; } int n = input->size(); if (start < n && stop < n) { return input->getText(misc::Interval::of(start,stop)); } else { return L"<EOF>"; } }
void ossimWebResponse::copyAllDataFromInputStream(ByteBuffer& buffer) { std::istream* input = getInputStream(); if(input) { input->seekg(0, std::ios::beg); char buf[1024]; while(!input->eof()&&input->good()) { input->read(buf, 1024); int gcount = input->gcount(); if(gcount) { buffer.insert(buffer.end(), buf , buf + gcount); } } } }
UtlXMLStream::UtlXMLStream(const std::string& sFileName, const bool bModeRead) : _bOwnerOfFileStream(true), _pInputStream(NULL), _pOutputStream(NULL) { if (!bModeRead) { _pOutputStream = CodeWorker::openOutputFile(sFileName.c_str()); if (_pOutputStream == NULL) throw UtlException("unable to open file \"" + sFileName + "\" for writing"); getOutputStream() << "<?xml version=\"1.0\" ?>" << std::endl; } else { _pInputStream = ScpStream::openSTLInputFile(sFileName.c_str()); if (_pInputStream == NULL) throw UtlException("unable to open file \"" + sFileName + "\" for reading"); std::string sLineVersion; if ( ! readLine(getInputStream() , sLineVersion) ) { throw UtlException("No version line in XML file: " + sFileName ); } } _sFileName=sFileName; }
DriverDataDispatcher* addUartDriverDataDispatcher( StreamLink* streamLink, char* dispatcherName, unsigned int targetUartIndex) { Buffer* inputBuffer = streamLink->inputBuffer; InputStream* inputStream = getInputStream(inputBuffer); OutputStream* outputStream = streamLink->outputStream; DriverDataDispatcher* result = addDriverDataDispatcher( TRANSMIT_UART, dispatcherName, NULL, targetUartIndex, inputStream, outputStream, remoteDriverDataDispatcherTransmit); // Clear previous data to avoid buffer from the other board // TODO : Check if we must to this at this time // clearInputStream(result->inputStream); return result; }