예제 #1
0
void
CXMLTextEncoderStream::put_s64 (
  llrp_s64_t                    Value,
  const CFieldDescriptor *      pFieldDescriptor)
{
    const char *                pFieldName = pFieldDescriptor->m_pName;

    appendOpenTag(pFieldName);
    switch(pFieldDescriptor->m_eFieldFormat)
    {
    case CFieldDescriptor::FMT_NORMAL:
    case CFieldDescriptor::FMT_DEC:
    default:
#ifdef WIN32
        appendFormat("%I64d", Value);
#else
        appendFormat("%lld", Value);
#endif
        break;

    case CFieldDescriptor::FMT_HEX:
#ifdef WIN32
        appendFormat("%016I64X", Value);
#else
        appendFormat("%016llX", Value);
#endif
        break;
    }
    appendCloseTag(pFieldName);
}
예제 #2
0
void
CXMLTextEncoderStream::put_s32v (
  llrp_s32v_t                   Value,
  const CFieldDescriptor *      pFieldDescriptor)
{
    const char *                pFieldName = pFieldDescriptor->m_pName;

    appendOpenTag(pFieldName);
    for(int i = 0; i < Value.m_nValue; i++)
    {
        if(0 < i)
        {
            appendFormat(" ");
        }
        switch(pFieldDescriptor->m_eFieldFormat)
        {
        case CFieldDescriptor::FMT_NORMAL:
        case CFieldDescriptor::FMT_DEC:
        default:
            appendFormat("%d", Value.m_pValue[i]);
            break;

        case CFieldDescriptor::FMT_HEX:
            appendFormat("%08X", Value.m_pValue[i]);
            break;
        }
    }
    appendCloseTag(pFieldName);
}
예제 #3
0
void
CXMLTextEncoderStream::put_enum (
  int                           eValue,
  const CFieldDescriptor *      pFieldDescriptor)
{
    const char *                pFieldName = pFieldDescriptor->m_pName;
    const SEnumTableEntry *     pEntry;

    appendOpenTag(pFieldName);

    for(pEntry = pFieldDescriptor->m_pEnumTable;
        NULL != pEntry->pName;
        pEntry++)
    {
        if(pEntry->Value == eValue)
        {
            break;
        }
    }

    if(NULL != pEntry->pName)
    {
        appendFormat("%s", pEntry->pName);
    }
    else
    {
        appendFormat("%d", eValue);
    }

    appendCloseTag(pFieldName);
}
예제 #4
0
void
CXMLTextEncoderStream::put_utf8v (
  llrp_utf8v_t                  Value,
  const CFieldDescriptor *      pFieldDescriptor)
{
    const char *                pFieldName = pFieldDescriptor->m_pName;

    appendOpenTag(pFieldName);
    for(int i = 0; i < Value.m_nValue; i++)
    {
        int         c = Value.m_pValue[i];

        if(0 == c && i+1 == Value.m_nValue)
        {
            continue;
        }
        if(' ' <= c && c < 0x7F)
        {
            appendFormat("%c", c);
        }
        else
        {
            appendFormat("\\%03o", c);
        }
    }
    appendCloseTag(pFieldName);
}
예제 #5
0
void
CXMLTextEncoderStream::appendCloseTag (
  const char *                  pName)
{
    appendFormat("</");
    appendPrefixedTagName(pName);
    appendFormat(">\n");
}
예제 #6
0
void
CXMLTextEncoderStream::appendOpenTag (
  const char *                  pName)
{
    indent(0);
    appendFormat("<");
    appendPrefixedTagName(pName);
    appendFormat(">");
}
예제 #7
0
TEST(stringify, vprintf_overflow) {
    std::string c(129, 'A');
    cstring test_str = c;
    cstring str = appendFormat("%s", test_str);
    EXPECT_EQ(str.c_str(), test_str.c_str());
    EXPECT_EQ(str.size(), test_str.size());
}
예제 #8
0
void
CXMLTextEncoderStream::put_reserved (
  unsigned int                  nBits)
{
    indent();
    appendFormat("<!-- reserved %d bits -->\n", nBits);
}
예제 #9
0
void
CXMLTextEncoderStream::appendPrefixedTagName (
  const char *                  pName)
{
    const CTypeDescriptor *     pRefType = m_pRefType;
    const char *                pPrefix =
                                  pRefType->m_pNamespaceDescriptor->m_pPrefix;

    if(0 != strcmp("llrp", pPrefix))
    {
        appendFormat("%s:%s", pPrefix, pName);
    }
    else
    {
        appendFormat("%s", pName);
    }
}
예제 #10
0
void
CXMLTextEncoderStream::put_u64 (
  llrp_u64_t                    Value,
  const CFieldDescriptor *      pFieldDescriptor)
{
    const char *                pFieldName = pFieldDescriptor->m_pName;

    appendOpenTag(pFieldName);
    switch(pFieldDescriptor->m_eFieldFormat)
    {
    case CFieldDescriptor::FMT_NORMAL:
    case CFieldDescriptor::FMT_DEC:
    default:
#ifdef WIN32
        appendFormat("%I64u", Value);
#else
        appendFormat("%llu", Value);
#endif
        break;

    case CFieldDescriptor::FMT_HEX:
#ifdef WIN32
        appendFormat("%016I64X", Value);
#else
        appendFormat("%016llX", Value);
#endif
        break;

    case CFieldDescriptor::FMT_DATETIME:
        {
            char                aBuf[64];
            time_t              CurSec  = (time_t)(Value / 1000000u);
            llrp_u32_t          CurUSec = (llrp_u32_t)(Value % 1000000u);
            struct tm *         pGMTime;

            pGMTime = gmtime(&CurSec);
            strftime(aBuf, sizeof aBuf, "%Y-%m-%dT%H:%M:%S", pGMTime);
            appendFormat("%s.%06dZ", aBuf, CurUSec);
        }
        break;
    }
    appendCloseTag(pFieldName);
}
예제 #11
0
void
CXMLTextEncoderStream::indent (
  int                           adjust)
{
    int                         n = m_nDepth + adjust;

    for(int i = 0; i < n; i++)
    {
        appendFormat("  ");
    }
}
예제 #12
0
void
CXMLTextEncoderStream::put_u2 (
  llrp_u2_t                     Value,
  const CFieldDescriptor *      pFieldDescriptor)
{
    const char *                pFieldName = pFieldDescriptor->m_pName;

    appendOpenTag(pFieldName);
    appendFormat("%d", Value & 3);
    appendCloseTag(pFieldName);
}
예제 #13
0
void
CXMLTextEncoderStream::put_u1v (
  llrp_u1v_t                    Value,
  const CFieldDescriptor *      pFieldDescriptor)
{
    const char *                pFieldName = pFieldDescriptor->m_pName;
    int                         nByte;

    nByte = (Value.m_nBit + 7u) / 8u;

    indent();
    appendFormat("<");
    appendPrefixedTagName(pFieldName);
    appendFormat(" Count='%d'>", Value.m_nBit);

    for(int i = 0; i < nByte; i++)
    {
        appendFormat("%02X", Value.m_pValue[i]);
    }

    appendCloseTag(pFieldName);
}
예제 #14
0
void
CXMLTextEncoderStream::putElement (
  const CElement *              pElement)
{
    m_pRefType = pElement->m_pType;

    indent(-1);
    appendFormat("<");
    appendPrefixedTagName(m_pRefType->m_pName);
    if(m_pRefType->m_bIsMessage)
    {
        appendFormat(" MessageID='%u'",
            ((const CMessage *)pElement)->getMessageID());
    }

    if(NULL == m_pEnclosingEncoderStream)
    {
        tNamespaceList          NamespaceList;
        const CNamespaceDescriptor *pNamespaceDescriptor;
        int                     iNSD;

        memset(&NamespaceList, 0, sizeof NamespaceList);

        pElement->walk(discoverNamespaces, (void*)&NamespaceList,
            0, 12);

        /* Emit the namespace cookie for each */
        for(iNSD = 0; iNSD < NamespaceList.nNamespaceDescriptor; iNSD++)
        {
            pNamespaceDescriptor = NamespaceList.apNamespaceDescriptor[iNSD];

            appendFormat("\n");
            indent(0);
            appendFormat("xmlns:%s='%s'",
                pNamespaceDescriptor->m_pPrefix,
                pNamespaceDescriptor->m_pURI);
            /*
             * If this is the default namespace then emit the assigment.
             */
            if(0 == strcmp(pNamespaceDescriptor->m_pPrefix, "llrp"))
            {
                appendFormat("\n");
                indent(0);
                appendFormat("xmlns='%s'", pNamespaceDescriptor->m_pURI);
            }
        }
    }
    appendFormat(">\n");

    pElement->encode(this);

    indent(-1);
    appendCloseTag(m_pRefType->m_pName);
}
예제 #15
0
void
CXMLTextEncoderStream::put_e8v (
  llrp_u8v_t                    Value,
  const CFieldDescriptor *      pFieldDescriptor)
{
    const char *                pFieldName = pFieldDescriptor->m_pName;

    appendOpenTag(pFieldName);
    for(int i = 0; i < Value.m_nValue; i++)
    {
        int                     eValue = Value.m_pValue[i];
        const SEnumTableEntry * pEntry;

        for(pEntry = pFieldDescriptor->m_pEnumTable;
            NULL != pEntry->pName;
            pEntry++)
        {
            if(pEntry->Value == eValue)
            {
                break;
            }
        }

        if(0 < i)
        {
            appendFormat(" ");
        }

        if(NULL != pEntry->pName)
        {
            appendFormat("%s", pEntry->pName);
        }
        else
        {
            appendFormat("%d", eValue);
        }
    }
    appendCloseTag(pFieldName);
}
예제 #16
0
void
CXMLTextEncoderStream::put_u1 (
  llrp_u1_t                     Value,
  const CFieldDescriptor *      pFieldDescriptor)
{
    const char *                pFieldName = pFieldDescriptor->m_pName;

    appendOpenTag(pFieldName);
    switch(pFieldDescriptor->m_eFieldFormat)
    {
    case CFieldDescriptor::FMT_NORMAL:
    default:
        appendFormat("%s", (Value & 1) ? "true" : "false");
        break;

    case CFieldDescriptor::FMT_DEC:
    case CFieldDescriptor::FMT_HEX:
        appendFormat("%d", Value & 1);
        break;
    }
    appendCloseTag(pFieldName);
}
예제 #17
0
void
CXMLTextEncoderStream::put_s32 (
  llrp_s32_t                    Value,
  const CFieldDescriptor *      pFieldDescriptor)
{
    const char *                pFieldName = pFieldDescriptor->m_pName;

    appendOpenTag(pFieldName);
    switch(pFieldDescriptor->m_eFieldFormat)
    {
    case CFieldDescriptor::FMT_NORMAL:
    case CFieldDescriptor::FMT_DEC:
    default:
        appendFormat("%d", Value);
        break;

    case CFieldDescriptor::FMT_HEX:
        appendFormat("%08X", Value);
        break;
    }
    appendCloseTag(pFieldName);
}
예제 #18
0
void
CXMLTextEncoderStream::put_bytesToEnd (
  llrp_bytesToEnd_t             Value,
  const CFieldDescriptor *      pFieldDescriptor)
{
    const char *                pFieldName = pFieldDescriptor->m_pName;

    appendOpenTag(pFieldName);
    for(int i = 0; i < Value.m_nValue; i++)
    {
        appendFormat("%02X", Value.m_pValue[i]);
    }
    appendCloseTag(pFieldName);
}
예제 #19
0
void
CXMLTextEncoderStream::put_s64v (
  llrp_s64v_t                   Value,
  const CFieldDescriptor *      pFieldDescriptor)
{
    const char *                pFieldName = pFieldDescriptor->m_pName;

    appendOpenTag(pFieldName);
    for(int i = 0; i < Value.m_nValue; i++)
    {
        if(0 < i)
        {
            appendFormat(" ");
        }
        switch(pFieldDescriptor->m_eFieldFormat)
        {
        case CFieldDescriptor::FMT_NORMAL:
        case CFieldDescriptor::FMT_DEC:
        default:
#ifdef WIN32
            appendFormat("%I64d", Value.m_pValue[i]);
#else
            appendFormat("%lld", Value.m_pValue[i]);
#endif
            break;

        case CFieldDescriptor::FMT_HEX:
#ifdef WIN32
            appendFormat("%016I64X", Value.m_pValue[i]);
#else
            appendFormat("%016llX", Value.m_pValue[i]);
#endif
            break;
        }
    }
    appendCloseTag(pFieldName);
}
예제 #20
0
void
CXMLTextEncoderStream::putRequiredSubParameter (
  const CParameter *            pParameter,
  const CTypeDescriptor *       pRefType)
{
    if(NULL == pParameter)
    {
        appendFormat("warning: missing %s\n",
            (NULL == pRefType) ? "<something>" : pRefType->m_pName);
        return;
    }

    CXMLTextEncoderStream         NestEncoderStream(this);

    NestEncoderStream.putElement(pParameter);
}
예제 #21
0
void
CXMLTextEncoderStream::putRequiredSubParameterList (
  const tListOfParameters *     pParameterList,
  const CTypeDescriptor *       pRefType)
{
    if(pParameterList->empty())
    {
        appendFormat("warning: missing list of %s\n",
            (NULL == pRefType) ? "<something>" : pRefType->m_pName);
        return;
    }

    for(
        tListOfParameters::const_iterator Cur = pParameterList->begin();
        Cur != pParameterList->end();
        Cur++)
    {
        putRequiredSubParameter(*Cur, pRefType);
    }
}
예제 #22
0
UtlString& UtlString::appendBinaryToString(const void* binaryData, int numBytes, int valuesPerRow)
{
    const unsigned char* currentByte = (const unsigned char*) binaryData;
    for(int byteCount = 0; byteCount < numBytes; byteCount++)
    {
        // Start a new row
        if(byteCount > 0 && (byteCount % valuesPerRow) == 0)
        {
            append('\n');
        }

        // Add space to deliniate 2 byte pair
        else if(byteCount > 0 && (byteCount % 2) == 0)
        {
            append(' ');
        }

        appendFormat("%02x", *currentByte);
        currentByte++;
    }

    return(*this);
}
예제 #23
0
TEST(stringify, vprintf_empty) {
    cstring str = appendFormat("%s", "");
    EXPECT_EQ(str, "");
}
예제 #24
0
QDomDocument getCapabilities( QgsServerInterface* serverIface, const QString& version,
                              const QgsServerRequest& request, bool projectSettings )
{
    QDomDocument doc;
    QDomElement wmsCapabilitiesElement;

    QgsWmsConfigParser* configParser = getConfigParser( serverIface );

    QgsServerRequest::Parameters parameters = request.parameters();

    // Get service URL
    QUrl href = serviceUrl( request, configParser );

    //href needs to be a prefix
    QString hrefString = href.toString( QUrl::FullyDecoded );
    hrefString.append( href.hasQuery() ? "&" : "?" );

    // XML declaration
    QDomProcessingInstruction xmlDeclaration = doc.createProcessingInstruction( QStringLiteral( "xml" ),
            QStringLiteral( "version=\"1.0\" encoding=\"utf-8\"" ) );

    // Append format helper
    std::function < void ( QDomElement&, const QString& ) > appendFormat = [&doc]( QDomElement & elem, const QString & format )
    {
        QDomElement formatElem = doc.createElement( QStringLiteral( "Format" )/*wms:Format*/ );
        formatElem.appendChild( doc.createTextNode( format ) );
        elem.appendChild( formatElem );
    };

    if ( version == QLatin1String( "1.1.1" ) )
    {
        doc = QDomDocument( QStringLiteral( "WMT_MS_Capabilities SYSTEM 'http://schemas.opengis.net/wms/1.1.1/WMS_MS_Capabilities.dtd'" ) );  //WMS 1.1.1 needs DOCTYPE  "SYSTEM http://schemas.opengis.net/wms/1.1.1/WMS_MS_Capabilities.dtd"
        doc.appendChild( xmlDeclaration );
        wmsCapabilitiesElement = doc.createElement( QStringLiteral( "WMT_MS_Capabilities" )/*wms:WMS_Capabilities*/ );
    }
    else // 1.3.0 as default
    {
        doc.appendChild( xmlDeclaration );
        wmsCapabilitiesElement = doc.createElement( QStringLiteral( "WMS_Capabilities" )/*wms:WMS_Capabilities*/ );
        wmsCapabilitiesElement.setAttribute( QStringLiteral( "xmlns" ), QStringLiteral( "http://www.opengis.net/wms" ) );
        wmsCapabilitiesElement.setAttribute( QStringLiteral( "xmlns:sld" ), QStringLiteral( "http://www.opengis.net/sld" ) );
        wmsCapabilitiesElement.setAttribute( QStringLiteral( "xmlns:qgs" ), QStringLiteral( "http://www.qgis.org/wms" ) );
        wmsCapabilitiesElement.setAttribute( QStringLiteral( "xmlns:xsi" ), QStringLiteral( "http://www.w3.org/2001/XMLSchema-instance" ) );
        QString schemaLocation = QStringLiteral( "http://www.opengis.net/wms" );
        schemaLocation += QLatin1String( " http://schemas.opengis.net/wms/1.3.0/capabilities_1_3_0.xsd" );
        schemaLocation += QLatin1String( " http://www.opengis.net/sld" );
        schemaLocation += QLatin1String( " http://schemas.opengis.net/sld/1.1.0/sld_capabilities.xsd" );
        schemaLocation += QLatin1String( " http://www.qgis.org/wms" );
        if ( configParser && configParser->wmsInspireActivated() )
        {
            wmsCapabilitiesElement.setAttribute( QStringLiteral( "xmlns:inspire_common" ), QStringLiteral( "http://inspire.ec.europa.eu/schemas/common/1.0" ) );
            wmsCapabilitiesElement.setAttribute( QStringLiteral( "xmlns:inspire_vs" ), QStringLiteral( "http://inspire.ec.europa.eu/schemas/inspire_vs/1.0" ) );
            schemaLocation += QLatin1String( " http://inspire.ec.europa.eu/schemas/inspire_vs/1.0" );
            schemaLocation += QLatin1String( " http://inspire.ec.europa.eu/schemas/inspire_vs/1.0/inspire_vs.xsd" );
        }

        schemaLocation += " " + hrefString + "SERVICE=WMS&REQUEST=GetSchemaExtension";
        wmsCapabilitiesElement.setAttribute( QStringLiteral( "xsi:schemaLocation" ), schemaLocation );
    }
    wmsCapabilitiesElement.setAttribute( QStringLiteral( "version" ), version );
    doc.appendChild( wmsCapabilitiesElement );

    configParser->serviceCapabilities( wmsCapabilitiesElement, doc );

    //wms:Capability element
    QDomElement capabilityElement = doc.createElement( QStringLiteral( "Capability" )/*wms:Capability*/ );
    wmsCapabilitiesElement.appendChild( capabilityElement );
    //wms:Request element
    QDomElement requestElement = doc.createElement( QStringLiteral( "Request" )/*wms:Request*/ );
    capabilityElement.appendChild( requestElement );

    QDomElement dcpTypeElement = doc.createElement( QStringLiteral( "DCPType" )/*wms:DCPType*/ );
    QDomElement httpElement = doc.createElement( QStringLiteral( "HTTP" )/*wms:HTTP*/ );
    dcpTypeElement.appendChild( httpElement );

    QDomElement elem;

    //wms:GetCapabilities
    elem = doc.createElement( QStringLiteral( "GetCapabilities" )/*wms:GetCapabilities*/ );
    appendFormat( elem, ( version == QLatin1String( "1.1.1" ) ? "application/vnd.ogc.wms_xml" : "text/xml" ) );
    elem.appendChild( dcpTypeElement );
    requestElement.appendChild( elem );

    // SOAP platform
    //only give this information if it is not a WMS request to be in sync with the WMS capabilities schema
    // XXX Not even sure that cam be ever true
    if ( parameters.value( QStringLiteral( "SERVICE" ) ).compare( QLatin1String( "WMS" ), Qt::CaseInsensitive ) != 0 )
    {
        QDomElement soapElement = doc.createElement( QStringLiteral( "SOAP" )/*wms:SOAP*/ );
        httpElement.appendChild( soapElement );
        QDomElement soapResourceElement = doc.createElement( QStringLiteral( "OnlineResource" )/*wms:OnlineResource*/ );
        soapResourceElement.setAttribute( QStringLiteral( "xmlns:xlink" ), QStringLiteral( "http://www.w3.org/1999/xlink" ) );
        soapResourceElement.setAttribute( QStringLiteral( "xlink:type" ), QStringLiteral( "simple" ) );
        soapResourceElement.setAttribute( QStringLiteral( "xlink:href" ), hrefString );
        soapElement.appendChild( soapResourceElement );
    }

    //only Get supported for the moment
    QDomElement getElement = doc.createElement( QStringLiteral( "Get" )/*wms:Get*/ );
    httpElement.appendChild( getElement );
    QDomElement olResourceElement = doc.createElement( QStringLiteral( "OnlineResource" )/*wms:OnlineResource*/ );
    olResourceElement.setAttribute( QStringLiteral( "xmlns:xlink" ), QStringLiteral( "http://www.w3.org/1999/xlink" ) );
    olResourceElement.setAttribute( QStringLiteral( "xlink:type" ), QStringLiteral( "simple" ) );
    olResourceElement.setAttribute( QStringLiteral( "xlink:href" ), hrefString );
    getElement.appendChild( olResourceElement );

    //wms:GetMap
    elem = doc.createElement( QStringLiteral( "GetMap" )/*wms:GetMap*/ );
    appendFormat( elem, QStringLiteral( "image/jpeg" ) );
    appendFormat( elem, QStringLiteral( "image/png" ) );
    appendFormat( elem, QStringLiteral( "image/png; mode=16bit" ) );
    appendFormat( elem, QStringLiteral( "image/png; mode=8bit" ) );
    appendFormat( elem, QStringLiteral( "image/png; mode=1bit" ) );
    appendFormat( elem, QStringLiteral( "application/dxf" ) );
    elem.appendChild( dcpTypeElement.cloneNode().toElement() ); //this is the same as for 'GetCapabilities'
    requestElement.appendChild( elem );

    //wms:GetFeatureInfo
    elem = doc.createElement( QStringLiteral( "GetFeatureInfo" ) );
    appendFormat( elem, QStringLiteral( "text/plain" ) );
    appendFormat( elem, QStringLiteral( "text/html" ) );
    appendFormat( elem, QStringLiteral( "text/xml" ) );
    appendFormat( elem, QStringLiteral( "application/vnd.ogc.gml" ) );
    appendFormat( elem, QStringLiteral( "application/vnd.ogc.gml/3.1.1" ) );
    elem.appendChild( dcpTypeElement.cloneNode().toElement() ); //this is the same as for 'GetCapabilities'
    requestElement.appendChild( elem );

    //wms:GetLegendGraphic
    elem = doc.createElement(( version == QLatin1String( "1.1.1" ) ? "GetLegendGraphic" : "sld:GetLegendGraphic" )/*wms:GetLegendGraphic*/ );
    appendFormat( elem, QStringLiteral( "image/jpeg" ) );
    appendFormat( elem, QStringLiteral( "image/png" ) );
    elem.appendChild( dcpTypeElement.cloneNode().toElement() ); // this is the same as for 'GetCapabilities'
    requestElement.appendChild( elem );

    //wms:DescribeLayer
    elem = doc.createElement(( version == QLatin1String( "1.1.1" ) ? "DescribeLayer" : "sld:DescribeLayer" )/*wms:GetLegendGraphic*/ );
    appendFormat( elem, QStringLiteral( "text/xml" ) );
    elem.appendChild( dcpTypeElement.cloneNode().toElement() ); // this is the same as for 'GetCapabilities'
    requestElement.appendChild( elem );

    //wms:GetStyles
    elem = doc.createElement(( version == QLatin1String( "1.1.1" ) ? "GetStyles" : "qgs:GetStyles" )/*wms:GetStyles*/ );
    appendFormat( elem, QStringLiteral( "text/xml" ) );
    elem.appendChild( dcpTypeElement.cloneNode().toElement() ); //this is the same as for 'GetCapabilities'
    requestElement.appendChild( elem );

    if ( projectSettings ) //remove composer templates from GetCapabilities in the long term
    {
        //wms:GetPrint
        elem = doc.createElement( QStringLiteral( "GetPrint" ) /*wms:GetPrint*/ );
        appendFormat( elem, QStringLiteral( "svg" ) );
        appendFormat( elem, QStringLiteral( "png" ) );
        appendFormat( elem, QStringLiteral( "pdf" ) );
        elem.appendChild( dcpTypeElement.cloneNode().toElement() ); //this is the same as for 'GetCapabilities'
        requestElement.appendChild( elem );
    }

    //Exception element is mandatory
    elem = doc.createElement( QStringLiteral( "Exception" ) );
    appendFormat( elem, ( version == QLatin1String( "1.1.1" ) ? "application/vnd.ogc.se_xml" : "XML" ) );
    capabilityElement.appendChild( elem );

    //UserDefinedSymbolization element
    if ( version == QLatin1String( "1.3.0" ) )
    {
        elem = doc.createElement( QStringLiteral( "sld:UserDefinedSymbolization" ) );
        elem.setAttribute( QStringLiteral( "SupportSLD" ), QStringLiteral( "1" ) );
        elem.setAttribute( QStringLiteral( "UserLayer" ), QStringLiteral( "0" ) );
        elem.setAttribute( QStringLiteral( "UserStyle" ), QStringLiteral( "1" ) );
        elem.setAttribute( QStringLiteral( "RemoteWFS" ), QStringLiteral( "0" ) );
        elem.setAttribute( QStringLiteral( "InlineFeature" ), QStringLiteral( "0" ) );
        elem.setAttribute( QStringLiteral( "RemoteWCS" ), QStringLiteral( "0" ) );
        capabilityElement.appendChild( elem );

        if ( configParser->wmsInspireActivated() )
        {
            configParser->inspireCapabilities( capabilityElement, doc );
        }
    }

    if ( projectSettings )
    {
        //Insert <ComposerTemplate> elements derived from wms:_ExtendedCapabilities
        configParser->printCapabilities( capabilityElement, doc );

        //WFS layers
        QStringList wfsLayers = configParser->wfsLayerNames();
        if ( !wfsLayers.isEmpty() )
        {
            QDomElement wfsLayersElem = doc.createElement( QStringLiteral( "WFSLayers" ) );
            for ( auto wfsIt = wfsLayers.constBegin() ; wfsIt != wfsLayers.constEnd(); ++wfsIt )
            {
                QDomElement wfsLayerElem = doc.createElement( QStringLiteral( "WFSLayer" ) );
                wfsLayerElem.setAttribute( QStringLiteral( "name" ), *wfsIt );
                wfsLayersElem.appendChild( wfsLayerElem );
            }
            capabilityElement.appendChild( wfsLayersElem );
        }
    }

    //add the xml content for the individual layers/styles
    configParser->layersAndStylesCapabilities( capabilityElement, doc, version, projectSettings );

    return doc;
}
예제 #25
0
TEST(stringify, vprintf_simple) {
    cstring str = appendFormat("%s", "AAA");
    EXPECT_EQ(str, "AAA");
}