⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 psbuttoninfo.cpp

📁 基于sipfoundy 公司开发的sipx协议API
💻 CPP
字号:
//// Copyright (C) 2004, 2005 Pingtel Corp.// //// $$//////////////////////////////////////////////////////////////////////////////// SYSTEM INCLUDES#include <assert.h>// APPLICATION INCLUDES#include "ps/PsButtonInfo.h"// EXTERNAL FUNCTIONS// EXTERNAL VARIABLES// CONSTANTS// STATIC VARIABLE INITIALIZATIONS/* //////////////////////////// PUBLIC //////////////////////////////////// *//* ============================ CREATORS ================================== */// Constructor// Default values are provided for all of the arguments so that it is// possible to allocate an array of PsButtonInfo objects.PsButtonInfo::PsButtonInfo(int buttonId, const char* name, int eventMask,                           const OsTime& repeatInterval):  mButtonId(buttonId),   mButtonState(UP),   mEventMask(eventMask),   mRepeatInterval(repeatInterval){   // all of the interesting work is done by the initializers   assert(eventMask & BUTTON_DOWN ||          eventMask & BUTTON_UP   ||          eventMask & BUTTON_REPEAT);   if (name)   {           mpButtonName = new char[strlen(name) + 1];           strcpy(mpButtonName, name);   }   else           mpButtonName = NULL;}// Copy constructorPsButtonInfo::PsButtonInfo(const PsButtonInfo& rPsButtonInfo){   if (rPsButtonInfo.mpButtonName)   {           mpButtonName = new char[strlen(rPsButtonInfo.mpButtonName) + 1];           strcpy(mpButtonName, rPsButtonInfo.mpButtonName);   }   else           mpButtonName = NULL;   mButtonId       = rPsButtonInfo.mButtonId;   mButtonState    = rPsButtonInfo.mButtonState;   mEventMask      = rPsButtonInfo.mEventMask;   mRepeatInterval = rPsButtonInfo.mRepeatInterval;}// DestructorPsButtonInfo::~PsButtonInfo(){        if (mpButtonName)        {                delete[] mpButtonName;                mpButtonName = 0;        }}/* ============================ MANIPULATORS ============================== */// Assignment operatorPsButtonInfo&PsButtonInfo::operator=(const PsButtonInfo& rhs){   if (this == &rhs)            // handle the assignment to self case      return *this;   if (mpButtonName)            // free the storage for the old name      delete[] mpButtonName;   if (rhs.mpButtonName)   {           mpButtonName = new char[strlen(rhs.mpButtonName) + 1];           strcpy(mpButtonName, rhs.mpButtonName);   }   else           mpButtonName = NULL;   mButtonId       = rhs.mButtonId;   mButtonState    = rhs.mButtonState;   mEventMask      = rhs.mEventMask;   mRepeatInterval = rhs.mRepeatInterval;   return *this;}// Set the button state to either UP or DOWNvoid PsButtonInfo::setState(int buttonState){   assert(buttonState == UP || buttonState == DOWN);   mButtonState = buttonState;}/* ============================ ACCESSORS ================================= */// Return the set of event types that are being handled for this buttonint PsButtonInfo::getEventMask(void) const{   return mEventMask;}// Return the button IDint PsButtonInfo::getId(void) const{   return mButtonId;}// Return the button Namechar* PsButtonInfo::getName(void) const{   return mpButtonName;}// Get the repeat interval for this buttonvoid PsButtonInfo::getRepInterval(OsTime& repeatIntvl) const{   repeatIntvl = mRepeatInterval;}// Return the button state (UP or DOWN)int PsButtonInfo::getState(void) const{   return mButtonState;}/* ============================ INQUIRY =================================== *//* //////////////////////////// PROTECTED ///////////////////////////////// *//* //////////////////////////// PRIVATE /////////////////////////////////// *//* ============================ FUNCTIONS ================================= */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -