<commit_before>//
// Copyright (C) 2006-2013 SIPez LLC.  All rights reserved.
//
// Copyright (C) 2004-2006 SIPfoundry Inc.
// Licensed by SIPfoundry under the LGPL license.
//
// Copyright (C) 2004-2006 Pingtel Corp.  All rights reserved.
// Licensed to SIPfoundry under a Contributor Agreement.
//
// $$
///////////////////////////////////////////////////////////////////////////////

// SYSTEM INCLUDES
// APPLICATION INCLUDES
#include <os/OsIntTypes.h>
#include <os/OsSysLog.h>
#include <utl/UtlHashMapIterator.h>
#include <utl/XmlContent.h>
#include <net/SipResourceList.h>
#include <utl/UtlNameValueTokenizer.h>
#include <xmlparser/tinyxml.h>

// EXTERNAL FUNCTIONS
// EXTERNAL VARIABLES
// CONSTANTS
const UtlContainableType TYPE = "ResourceList";

// STATIC VARIABLE INITIALIZATIONS

/* //////////////////////////// PUBLIC //////////////////////////////////// */

/* ============================ CREATORS ================================== */

// Constructor
Resource::Resource(const char* uri)
{
   mUri = uri;
}


// Destructor
Resource::~Resource()
{
}

/* ============================ MANIPULATORS ============================== */

// Assignment operator
Resource&
Resource::operator=(const Resource& rhs)
{
   if (this == &rhs)            // handle the assignment to self case
      return *this;

   return *this;
}

// Copy constructor
Resource::Resource(const Resource& rResource)
{
   mUri = rResource.mUri;
}


/* ============================ ACCESSORS ================================= */
void Resource::getResourceUri(UtlString& uri) const
{
   uri = mUri;
}


void Resource::setName(const char* name)
{
   mName = name;
}


void Resource::getName(UtlString& name) const
{
   name = mName;
}


void Resource::setInstance(const char* id,
                           const char* state)
{
   mState = state;
   mId = id;
}


void Resource::getInstance(UtlString& id,
                           UtlString& state) const
{
   state = mState;
   id = mId;
}


int Resource::compareTo(const UtlContainable *b) const
{
   return mUri.compareTo(((Resource *)b)->mUri);
}


unsigned int Resource::hash() const
{
    return mUri.hash();
}


const UtlContainableType Resource::getContainableType() const
{
    return TYPE;
}


/* //////////////////////////// PUBLIC //////////////////////////////////// */

/* ============================ CREATORS ================================== */

// Constructor
SipResourceList::SipResourceList(const UtlBoolean state,
                                 const char* uri,
                                 const char* type)
   : mLock(OsBSem::Q_PRIORITY, OsBSem::FULL)
{
   remove(0);
   append(RESOURCE_LIST_CONTENT_TYPE);

   mVersion = 0;
   if (state)
   {
      mFullState = "true";
   }
   else
   {
      mFullState = "false";
   }
   
   mListUri = uri;
   mEventType = type;
}

SipResourceList::SipResourceList(const char* bodyBytes, const char* type)
   : mLock(OsBSem::Q_PRIORITY, OsBSem::FULL)
{
   remove(0);
   append(RESOURCE_LIST_CONTENT_TYPE);

   if(bodyBytes)
   {
      bodyLength = strlen(bodyBytes);
      parseBody(bodyBytes);
   }
   
   ((SipResourceList*)this)->mBody = bodyBytes;   
   mEventType = type;
}


// Destructor
SipResourceList::~SipResourceList()
{
   // Clean up all the resource elements
   if (!mResources.isEmpty())
   {
      mResources.destroyAll();
   }

   // Clean up all the event elements
   if (!mEvents.isEmpty())
   {
      mEvents.destroyAll();
   }
}

/* ============================ MANIPULATORS ============================== */

void SipResourceList::parseBody(const char* bodyBytes)
{
   if(bodyBytes)
   {
      OsSysLog::add(FAC_SIP, PRI_DEBUG, "SipResourceList::parseBody incoming package = %s\n", 
                    bodyBytes);
                    
      TiXmlDocument doc("ResourceList.xml");
      
      if (doc.Parse(bodyBytes))
      {
         TiXmlNode * rootNode = doc.FirstChild ("list");
        
         TiXmlElement* ucElement = 0;

      }
   }
}


// Assignment operator
SipResourceList&
SipResourceList::operator=(const SipResourceList& rhs)
{
   if (this == &rhs)            // handle the assignment to self case
      return *this;

   return *this;
}<commit_msg>Silenced compiler warnging in SipResourceList<commit_after>//
// Copyright (C) 2006-2017 SIPez LLC.  All rights reserved.
//
// Copyright (C) 2004-2006 SIPfoundry Inc.
// Licensed by SIPfoundry under the LGPL license.
//
// Copyright (C) 2004-2006 Pingtel Corp.  All rights reserved.
// Licensed to SIPfoundry under a Contributor Agreement.
//
// $$
///////////////////////////////////////////////////////////////////////////////

// SYSTEM INCLUDES
// APPLICATION INCLUDES
#include <os/OsIntTypes.h>
#include <os/OsSysLog.h>
#include <utl/UtlHashMapIterator.h>
#include <utl/XmlContent.h>
#include <net/SipResourceList.h>
#include <utl/UtlNameValueTokenizer.h>
#include <xmlparser/tinyxml.h>

// EXTERNAL FUNCTIONS
// EXTERNAL VARIABLES
// CONSTANTS
const UtlContainableType TYPE = "ResourceList";

// STATIC VARIABLE INITIALIZATIONS

/* //////////////////////////// PUBLIC //////////////////////////////////// */

/* ============================ CREATORS ================================== */

// Constructor
Resource::Resource(const char* uri)
{
   mUri = uri;
}


// Destructor
Resource::~Resource()
{
}

/* ============================ MANIPULATORS ============================== */

// Assignment operator
Resource&
Resource::operator=(const Resource& rhs)
{
   if (this == &rhs)            // handle the assignment to self case
      return *this;

   return *this;
}

// Copy constructor
Resource::Resource(const Resource& rResource)
{
   mUri = rResource.mUri;
}


/* ============================ ACCESSORS ================================= */
void Resource::getResourceUri(UtlString& uri) const
{
   uri = mUri;
}


void Resource::setName(const char* name)
{
   mName = name;
}


void Resource::getName(UtlString& name) const
{
   name = mName;
}


void Resource::setInstance(const char* id,
                           const char* state)
{
   mState = state;
   mId = id;
}


void Resource::getInstance(UtlString& id,
                           UtlString& state) const
{
   state = mState;
   id = mId;
}


int Resource::compareTo(const UtlContainable *b) const
{
   return mUri.compareTo(((Resource *)b)->mUri);
}


unsigned int Resource::hash() const
{
    return mUri.hash();
}


const UtlContainableType Resource::getContainableType() const
{
    return TYPE;
}


/* //////////////////////////// PUBLIC //////////////////////////////////// */

/* ============================ CREATORS ================================== */

// Constructor
SipResourceList::SipResourceList(const UtlBoolean state,
                                 const char* uri,
                                 const char* type)
   : mLock(OsBSem::Q_PRIORITY, OsBSem::FULL)
{
   remove(0);
   append(RESOURCE_LIST_CONTENT_TYPE);

   mVersion = 0;
   if (state)
   {
      mFullState = "true";
   }
   else
   {
      mFullState = "false";
   }
   
   mListUri = uri;
   mEventType = type;
}

SipResourceList::SipResourceList(const char* bodyBytes, const char* type)
   : mLock(OsBSem::Q_PRIORITY, OsBSem::FULL)
{
   remove(0);
   append(RESOURCE_LIST_CONTENT_TYPE);

   if(bodyBytes)
   {
      bodyLength = strlen(bodyBytes);
      parseBody(bodyBytes);
   }
   
   ((SipResourceList*)this)->mBody = bodyBytes;   
   mEventType = type;
}


// Destructor
SipResourceList::~SipResourceList()
{
   // Clean up all the resource elements
   if (!mResources.isEmpty())
   {
      mResources.destroyAll();
   }

   // Clean up all the event elements
   if (!mEvents.isEmpty())
   {
      mEvents.destroyAll();
   }
}

/* ============================ MANIPULATORS ============================== */

void SipResourceList::parseBody(const char* bodyBytes)
{
   if(bodyBytes)
   {
      OsSysLog::add(FAC_SIP, PRI_DEBUG, "SipResourceList::parseBody incoming package = %s\n", 
                    bodyBytes);
                    
      TiXmlDocument doc("ResourceList.xml");
      
      if (doc.Parse(bodyBytes))
      {
         TiXmlNode * rootNode = doc.FirstChild ("list");
         SIPX_UNUSED(rootNode);
      }
   }
}


// Assignment operator
SipResourceList&
SipResourceList::operator=(const SipResourceList& rhs)
{
   if (this == &rhs)            // handle the assignment to self case
      return *this;

   return *this;
}
{'fraction_non_alphanumeric': 0.2311174648558494, 'fraction_numerical': 0.006552299261377174, 'mean_word_length': 2.480514096185738, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 6}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1444613', 'n_tokens_mistral': 2668, 'n_tokens_neox': 2530, 'n_words': 548}