VirtualBox

Ignore:
Timestamp:
Aug 30, 2018 12:13:02 PM (7 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
124713
Message:

IPRT/rest: More request array and map setter methods. Fixed string defaults. Safer copying and resetToDefaults. bugref:9167

Location:
trunk/src/VBox/Runtime/common/rest
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/common/rest/RTCRestArrayBase.cpp

    r73968 r73977  
    2929*   Header Files                                                                                                                 *
    3030*********************************************************************************************************************************/
     31#define LOG_GROUP RTLOGGROUP_REST
    3132#include <iprt/cpp/restbase.h>
    3233
     
    8384*********************************************************************************************************************************/
    8485
    85 void RTCRestArrayBase::resetToDefault()
     86int RTCRestArrayBase::resetToDefault()
    8687{
    8788    /* The default state of an array is empty. At least for now. */
    8889    clear();
     90    return VINF_SUCCESS;
    8991}
    9092
  • trunk/src/VBox/Runtime/common/rest/RTCRestClientApiBase.cpp

    r73967 r73977  
    2929*   Header Files                                                                                                                 *
    3030*********************************************************************************************************************************/
     31#define LOG_GROUP RTLOGGROUP_REST
    3132#include <iprt/cpp/restbase.h>
    3233
    3334#include <iprt/err.h>
    3435#include <iprt/http.h>
     36#include <iprt/log.h>
    3537
    3638
     
    6264
    6365void RTCRestClientApiBase::doCall(RTCRestClientRequestBase const &a_rRequest, RTHTTPMETHOD a_enmHttpMethod,
    64                                   RTCRestClientResponseBase *a_pResponse)
     66                                  RTCRestClientResponseBase *a_pResponse, const char *a_pszMethod)
    6567{
     68    LogFlow(("doCall: %s %s\n", a_pszMethod, RTHttpMethodName(a_enmHttpMethod)));
     69
    6670    /*
    6771     * Initialize the HTTP instance.
     
    155159    }
    156160    a_pResponse->receiveComplete(rc, hHttp);
     161    RT_NOREF_PV(a_pszMethod);
    157162}
    158163
  • trunk/src/VBox/Runtime/common/rest/RTCRestClientRequestBase.cpp

    r73918 r73977  
    2929*   Header Files                                                                                                                 *
    3030*********************************************************************************************************************************/
     31#define LOG_GROUP RTLOGGROUP_REST
    3132#include <iprt/cpp/restbase.h>
    3233
     
    3738/**
    3839 * Default constructor.
    39  *  */
     40 */
    4041RTCRestClientRequestBase::RTCRestClientRequestBase()
     42    : m_fIsSet(0)
     43    , m_fErrorSet(0)
    4144{
    42     /* nothing to do */
     45}
     46
     47
     48/**
     49 * Copy constructor.
     50 */
     51RTCRestClientRequestBase::RTCRestClientRequestBase(RTCRestClientRequestBase const &a_rThat)
     52    : m_fIsSet(a_rThat.m_fIsSet)
     53    , m_fErrorSet(a_rThat.m_fErrorSet)
     54{
    4355}
    4456
     
    5062{
    5163    /* nothing to do */
     64}
     65
     66
     67/**
     68 * Copy assignment operator.
     69 */
     70RTCRestClientRequestBase &RTCRestClientRequestBase::operator=(RTCRestClientRequestBase const &a_rThat)
     71{
     72    m_fIsSet    = a_rThat.m_fIsSet;
     73    m_fErrorSet = a_rThat.m_fErrorSet;
     74    return *this;
    5275}
    5376
  • trunk/src/VBox/Runtime/common/rest/RTCRestClientResponseBase.cpp

    r73968 r73977  
    2929*   Header Files                                                                                                                 *
    3030*********************************************************************************************************************************/
     31#define LOG_GROUP RTLOGGROUP_REST
    3132#include <iprt/cpp/restbase.h>
    3233
  • trunk/src/VBox/Runtime/common/rest/RTCRestJsonPrimaryCursor.cpp

    r73875 r73977  
    2929*   Header Files                                                                                                                 *
    3030*********************************************************************************************************************************/
     31#define LOG_GROUP RTLOGGROUP_REST
    3132#include <iprt/cpp/restbase.h>
    3233
  • trunk/src/VBox/Runtime/common/rest/RTCRestOutputToString.cpp

    r73956 r73977  
    2929*   Header Files                                                                                                                 *
    3030*********************************************************************************************************************************/
     31#define LOG_GROUP RTLOGGROUP_REST
    3132#include <iprt/cpp/restbase.h>
    3233
  • trunk/src/VBox/Runtime/common/rest/RTCRestStringMapBase.cpp

    r73965 r73977  
    2929*   Header Files                                                                                                                 *
    3030*********************************************************************************************************************************/
     31#define LOG_GROUP RTLOGGROUP_REST
    3132#include <iprt/cpp/restbase.h>
    3233
     
    7273*********************************************************************************************************************************/
    7374
    74 void RTCRestStringMapBase::resetToDefault()
     75int RTCRestStringMapBase::resetToDefault()
    7576{
    7677    /* Default is an empty map. */
    7778    clear();
     79    return VINF_SUCCESS;
    7880}
    7981
  • trunk/src/VBox/Runtime/common/rest/rest-primary-object-types.cpp

    r73956 r73977  
    2929*   Header Files                                                                                                                 *
    3030*********************************************************************************************************************************/
     31#define LOG_GROUP RTLOGGROUP_REST
    3132#include <iprt/cpp/restbase.h>
    3233
     
    143144
    144145
    145 void RTCRestBool::resetToDefault()
     146int RTCRestBool::assignCopy(RTCRestBool const &a_rThat)
     147{
     148    m_fValue = a_rThat.m_fValue;
     149    return VINF_SUCCESS;
     150}
     151
     152
     153int RTCRestBool::resetToDefault()
    146154{
    147155    m_fValue = false;
     156    return VINF_SUCCESS;
    148157}
    149158
     
    265274
    266275
    267 void RTCRestInt64::resetToDefault()
     276int RTCRestInt64::assignCopy(RTCRestInt64 const &a_rThat)
     277{
     278    m_iValue = a_rThat.m_iValue;
     279    return VINF_SUCCESS;
     280}
     281
     282
     283int RTCRestInt64::resetToDefault()
    268284{
    269285    m_iValue = 0;
     286    return VINF_SUCCESS;
    270287}
    271288
     
    375392
    376393
    377 void RTCRestInt32::resetToDefault()
     394int RTCRestInt32::assignCopy(RTCRestInt32 const &a_rThat)
     395{
     396    m_iValue = a_rThat.m_iValue;
     397    return VINF_SUCCESS;
     398}
     399
     400
     401int RTCRestInt32::resetToDefault()
    378402{
    379403    m_iValue = 0;
     404    return VINF_SUCCESS;
    380405}
    381406
     
    491516
    492517
    493 void RTCRestInt16::resetToDefault()
     518int RTCRestInt16::assignCopy(RTCRestInt16 const &a_rThat)
     519{
     520    m_iValue = a_rThat.m_iValue;
     521    return VINF_SUCCESS;
     522}
     523
     524
     525int RTCRestInt16::resetToDefault()
    494526{
    495527    m_iValue = 0;
     528    return VINF_SUCCESS;
    496529}
    497530
     
    598631
    599632
    600 void RTCRestDouble::resetToDefault()
     633/** Copy assignment operator. */
     634RTCRestDouble &RTCRestDouble::operator=(RTCRestDouble const &a_rThat)
     635{
     636    m_rdValue = a_rThat.m_rdValue;
     637    return *this;
     638}
     639
     640
     641int RTCRestDouble::assignCopy(RTCRestDouble const &a_rThat)
     642{
     643    m_rdValue = a_rThat.m_rdValue;
     644    return VINF_SUCCESS;
     645}
     646
     647
     648int RTCRestDouble::resetToDefault()
    601649{
    602650    m_rdValue = 0.0;
     651    return VINF_SUCCESS;
    603652}
    604653
     
    715764
    716765
    717 void RTCRestString::resetToDefault()
     766int RTCRestString::assignCopy(RTCString const &a_rThat)
     767{
     768    return assignNoThrow(a_rThat);
     769}
     770
     771
     772int RTCRestString::assignCopy(const char *a_pszThat)
     773{
     774    return assignNoThrow(a_pszThat);
     775}
     776
     777
     778int RTCRestString::resetToDefault()
    718779{
    719780    setNull();
     781    return VINF_SUCCESS;
    720782}
    721783
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette