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

📄 cbrecord.cxx

📁 vovida的软交换
💻 CXX
字号:
/*  This implements 'Call Blocking' subclass of
 *  the 'Record' superclass.
 *
 *  CallBlockRecord.cxx     version 1.0 -- 18 Mar 2003
 *                          Suha Cubukcuoglu         
 */
 
#include "CBRecord.hxx"
#include <iostream>

CBRecord::CBRecord():
	// Initialize 'prefix' container
	prefix(0)
{
 	setRecordType(CB_RECORD);
}

CBRecord::~CBRecord() {}

void CBRecord::displayRecord()
{
	cout << "Displaying CallBlocking Record:\n";
    cout << "-------------------------------"   <<"\n";
    cout << "Account ID  :" << getAccountID()   <<"\n";
    cout << "Prefix List :" << "***********"    <<"\n\n";
    
    vector<string>::iterator i;
    
    for(i = prefix.begin(); i != prefix.end(); i++){
    	cout << *i <<"\n";
    }

    cout << "             " << "***********"  <<"\n";
}

/** Finds the prefix matching 'key'. Returns true if 'key'
 *  could not be found.
 */

bool CBRecord::findPrefix(string key)
{
	// create an iterator
	vector<string>::iterator i;
	// initialize the iterator
 	i = prefix.begin();
	
	// Check to see if 'key' exists in the vector.
	// If it does, return false.
	for(; i != prefix.end(); i++){
 		if (*i == key){
   			return false;
      	}
    }
    
    // The key could not be found
    return true;
} 

/** Deletes the prefix matching 'key'. Returns true
 *  if 'key' could not be found.
 */

bool CBRecord::deletePrefix(string key)
{
	// create an iterator
	vector<string>::iterator i;
	// initialize the iterator
 	i = prefix.begin();
 	
 	// Check to see if 'key' exists in the vector.
	// If it does, delete it and return false.
 	for(; i != prefix.end(); i++){
 		if (*i == key){
 			prefix.erase(i);
 			return false;
		}
	}

	// The key could not be found
	return true;
}
 		
bool CBRecord::populateRecord(KeyType key, DBConnection* dbcon) 
{ 
    setKey(key);
   
    cout << "Called Populate Record: key=" << key << " in CallBlocking Record\n\n";
                      
    return false;
}
 
bool CBRecord::amendRecord(DBConnection* dbconn)
{
    cout << "Called Amend Record in CallBlocking Record\n\n";

    // Would do a database AMEND here

    return false;
}

bool CBRecord::deleteRecord(DBConnection* dbconn)
{
    cout << "Called Delete Record in CallBlocking Record\n";

    // Would do a database DELETE here

    return false;
}

bool CBRecord::insertRecord(DBConnection* dbconn)
{
    cout << "Called Insert Record in CallBlocking Record\n";

    // Would do a database INSERT here

    return false;
}

KeyList CBRecord::getAllKeys(DBConnection* dbconn)
{ 
  KeyList l; 
  cout << "Called getAllKeys in CallBlocking Record\n";

  // Would do a database SELECT to get all relavent keys and 
  // return them in key list

  l.push_back("1");

  return l;
}

⌨️ 快捷键说明

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