本文整理汇总了C++中Customer::addAccount方法的典型用法代码示例。如果您正苦于以下问题:C++ Customer::addAccount方法的具体用法?C++ Customer::addAccount怎么用?C++ Customer::addAccount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Customer
的用法示例。
在下文中一共展示了Customer::addAccount方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ConstructAndAddUser
void ConstructAndAddUser(string strLine, TextFileDataSource* tfds)
{
DataMap* pdmUsers = tfds->getUsersCollection();
vector<string> vecstrLineSplit = StringUtils::splitString(strLine, ',');
int nUserID = TypeConverter(vecstrLineSplit[TextFileDataSource::USER_NAME]);
string strPassword = vecstrLineSplit[TextFileDataSource::PASSWORD];
int nUserType = TypeConverter(vecstrLineSplit[TextFileDataSource::USER_TYPE]);
if (nUserType == User::CUSTOMER)
{
// TODO ASSERTS HERE
string strName = vecstrLineSplit[TextFileDataSource::NAME];
string strAddress = vecstrLineSplit[TextFileDataSource::ADDRESS];
string strPhone = vecstrLineSplit[TextFileDataSource::PHONE_NUMBER];
Customer* pu = new Customer(nUserID, strPassword, strName, strAddress, strPhone);
// add accoutn ids
vector<string> vecstrAccountIds = StringUtils::splitString(vecstrLineSplit[TextFileDataSource::ACCOUNT_IDS],';');
for (unsigned nId = 0; nId < vecstrAccountIds.size(); nId++)
{
pu->addAccount(TypeConverter(vecstrAccountIds[nId]));
}
pdmUsers->Add(pu);
}
else if (nUserType == User::BANK_CLERK)
{
pdmUsers->Add
(
new BankClerk(nUserID, strPassword)
);
}
}
示例2: ConstructAndAddCustomer
void TextFileDataSource::ConstructAndAddCustomer(std::string line)
{
enum
{
USER_ID,
PASSWORD,
NAME,
ADDRESS,
PHONE_NUMBER,
ACCOUNT_IDS,
NUM_FIELDS
};
vector<std::string> lineSplit = stringUtils::splitstring(line, ',');
vector<std::string> accountIds = stringUtils::splitstring(lineSplit[ACCOUNT_IDS], ';');
// create customer
Customer* c = new Customer
(
TypeConverter(lineSplit[USER_ID]),
lineSplit[PASSWORD],
lineSplit[NAME],
lineSplit[ADDRESS],
lineSplit[PHONE_NUMBER]
);
// add account ids
vector<std::string>::iterator vit;
for (vit = accountIds.begin(); vit != accountIds.end(); ++vit)
{
c->addAccount(TypeConverter(*vit));
}
_users.add(c->getUserId(), c);
}