Beispiel #1
0
mstring operator+(mstring& str1, mstring& str2){
    mstring result;
    size_t len1 = str1.length();
    size_t len2 = str2.length();
    if (len1 + len2) {
        result.sz_Buf = (char*)malloc((len1+len2+1)*sizeof(char));
        if (result.sz_Buf) {
            if (len1 > 0) {
                strcpy(result.sz_Buf, str1.sz_Buf);
            }
            if (len2 > 0) {
                strcpy(result.sz_Buf+len1, str2.sz_Buf);
            }
        }
        result.len = len1 + len2;
    }
    return result;
}
Beispiel #2
0
int ModelicaXML::serializeXMLDocumentToFile(mstring xmlFileName)
{
  // fix the file
  XMLFormatTarget *myFormatTarget = new LocalFileFormatTarget(X(xmlFileName.c_str()));
  theOutputDesc->setByteStream(myFormatTarget);

  // serialize a DOMNode to the local file "
  domSerializer->write(pModelicaXMLDoc, theOutputDesc);

  myFormatTarget->flush();

  delete myFormatTarget;

  return 0;
}
Beispiel #3
0
bool mstring::operator<(const mstring& rhs) const{
    size_t minl = rhs.length();
    if (len < minl) {
        minl = len;
    }
    const char* buf2 = rhs;
    for (size_t i=0; i < minl; i++) {
        int c1 = tolower(*(sz_Buf+i));
        int c2 = tolower(*(buf2+i));
        if (c1 == c2) {
            continue;
        }
        return c1 < c2;
    }
    return (len == minl);
}
Beispiel #4
0
 ParseError(const mstring& msg) : std::exception(msg.c_str()) {}