本文整理汇总了C++中AString::split方法的典型用法代码示例。如果您正苦于以下问题:C++ AString::split方法的具体用法?C++ AString::split怎么用?C++ AString::split使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AString
的用法示例。
在下文中一共展示了AString::split方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
bool AFramework::MTempMaster::saveNetworkConfig(const AString &data) const{
bool flg = false;
if(!m_flag){
return false;
}
AStringList *list = NULL;
list = data.split(_MTEMP_SEP);
if(list && data.good()){
/*
* FORMATO STRINGA CONF
* (CLIENT) SSID*KEY*IP*PORT*USER*PASSWORD*[CONF]
*/
flg = (m_memory->write(_MTEMP_SSID_ADDRESS , list->at(0)) &&
m_memory->write(_MTEMP_SSID_KEY_ADDRESS , list->at(1)) &&
m_memory->write(_MTEMP_MASTER_IP_ADDRESS , list->at(2)) &&
m_memory->write(_MTEMP_MASTER_PORT_ADDRESS , list->at(3)) &&
m_memory->write(_MTEMP_USERNAME_ADDRESS , list->at(4)) &&
m_memory->write(_MTEMP_USER_KEY_ADDRESS , list->at(5)));
delete list;
return flg;
}
return false;
}
示例2: config
void SmartMote::config(){
AString conf;
AStringList * param = NULL;
bool flag;
/* se il bottone non è premuto */
if(!checkButton()){
/* ritorno */
return;
}
/* accendo l'uart */
openUART();
/* inizializzo il modulo come AP */
if(!m_net.initialize(AESP07::APMode)){
/* se fallisce notifico l'errore */
error();
}
/* setto il nome come SmartMote e password admin */
if(!m_net.configureAP("SmartMote", "smartmote")){
/* se fallisce notifico l'errore */
error();
}
/* imposto l'ip a 192.168.1.1 */
if(!m_net.setIp(AESP07::APMode, "192.168.1.1")){
/* se fallisce notifico l'errore */
error();
}
/* disabilito le connessioni multiple */
if(!m_net.setMultipleConnections(false)){
/* se fallisce notifico l'errore */
error();
}
/* apro il server sulla porta 8000 */
if(!m_net.listen(8000)){
/* se fallisce notifico l'errore */
error();
}
/* aspetto di ricevere la stringa */
while(conf.isEmpty()){
m_net.waitForData(conf);
}
/* prendo i parametri */
param = conf.split(' ');
/* se la stringlist è allocata correttamente */
if(param){
saveSSID(param->at(0));
saveKey(param->at(1));
saveHost(param->at(2));
RTCC.setHours(static_cast<uint32>(param->at(3).toInt32(flag)));
RTCC.setMinutes(static_cast<uint32>(param->at(3).toInt32(flag)));
RTCC.setSeconds(static_cast<uint32>(param->at(3).toInt32(flag)));
}else{
/* altrimenti notifico l'errore */
error();
}
/* spengo i led */
turnOffRed();
turnOffGreen();
}
示例3: doit
void doit(const AString& input)
{
LIST_AString words;
input.split(words);
for (LIST_AString::iterator it = words.begin(); it != words.end(); ++it)
{
AString tmp;
AString output;
AWordUtility::getPhoneticForm(*it, tmp);
AWordUtility::getSoundsLikeForm(tmp, output);
std::cout << *it << " : " << tmp << " : " << output << std::endl;
}
}
示例4: msg
void AFramework::MTempMaster::commandExec(const AString &cmd){
AStringList * list;
AString str;
ADateTime time;
bool flag = false;
uint8 index = 0;
uint8 index1 = 0;
list = cmd.split(_MTEMP_SEP);
if(list && cmd.good()){
if(list->at(0) == m_username && list->at(1) == m_password){
str = list->at(list->size() - 1);
if(str == _MTEMP_TIMESET){
//* (CLIENT) username*password*AA*MM*GG*WD*HH*MM*SS*[TIMESET]
if(time.setYear(list->at(2).toInt32(flag)) && flag){
if(time.setMonth(static_cast<ADateTime::Months>(list->at(3).toInt32(flag))) && flag){
if(time.setDayOfMonth(list->at(4).toInt32(flag)) && flag){
if(time.setWeekday(static_cast<ADateTime::Weekdays>(list->at(5).toInt32(flag))) && flag){
if(time.setHours(list->at(6).toInt32(flag)) && flag){
if(time.setMinutes(list->at(7).toInt32(flag)) && flag){
if(time.setSeconds(list->at(8).toInt32(flag)) && flag){
if(m_clk->setTime(time)){
if(m_wifi->send(_MTEMP_BOARD_OK)){
str.clear();
str = m_clk->currentTime().timeToString();
str.prepend("Ora settata\n");
msg(str, 0);
delete list;
return;
}
}
}
}
}
}
}
}
}
}else if(str == _MTEMP_TIMEGET){
//* (CLIENT) username*password*[TIMEGET]
//* (SERVER) (AA*MM*GG*WD*HH*MM*SS*[OK] || [FAIL] || [ERROR])
if(m_clk->isGood()){
str.clear();
time = m_clk->currentTime();
str += AString(time.year());
str += _MTEMP_SEP;
str += AString(static_cast<uint8>(time.month()));
str += _MTEMP_SEP;
str += AString(time.dayOfMonth());
str += _MTEMP_SEP;
str += AString(static_cast<uint8>(time.Weekday()));
str += _MTEMP_SEP;
str += AString(time.hours());
str += _MTEMP_SEP;
str += AString(time.minutes());
str += _MTEMP_SEP;
str += AString(time.seconds());
str += _MTEMP_SEP;
str += _MTEMP_BOARD_OK;
m_wifi->send(str);
delete list;
return;
}else{
m_wifi->send(_MTEMP_BOARD_FAIL);
msg("Errore...\nOrologio");
delete list;
return;
}
delete list;
return;
}else if(str == _MTEMP_TEMPGET){
//(CLIENT) username*password*R*[TEMPGET]
//(SERVER) R*TT*([OK] || [FAIL] || [ERROR])
index = list->at(2).toInt32(flag);
if(flag && index < _MTEMP_ROOM_VEC_SIZE){
str.clear();
str += list->at(2);
str += _MTEMP_SEP;
/////////////////////////////////////////////////////////////////////////////////////////
//.........这里部分代码省略.........
示例5: parse_line
void Data::parse_line(AString line) {
line = line.strip(" \t");
if (line.startswith("#")) return;
if (line.contains('=')) {
std::vector<AString> vec = line.split("=");
vec[0] = vec[0].strip(" ");
if (vec[1].contains('#'))
vec[1] = vec[1].lpartition("#")[0];
vec[1] = vec[1].strip(" ");
values[current_category][vec[0]] = vec[1];
}
else {
if (line.startswith("[")) {
current_category = line.strip("[]");
}
}
//if (line.length() == 0) return;
//int stage = 0;
//AString field;
//AString value;
//AString category;
//for (unsigned int i = 0; i < line.length(); i++) {
//char c = line[i];
//if (stage == 0) {
//if ( (c == ' ') || (c == '\t') )
//continue;
//else if (c == '=')
//stage = 1;
//else if (c == '#')
//return;
//else if (c == '[')
//stage = 3;
//else
//field += c;
//}
//else if (stage == 1) {
//if ( (c == ' ') || (c == '\t') )
//continue;
//else {
//stage = 2;
//value += c;
//}
//}
//else if (stage == 2) {
//value += c;
//}
//else if (stage == 3) {
//if ( c == ']' ) {
//current_category = category;
//return;
//}
//else
//category += c;
//}
//}
//this->values[current_category][field] = value;
}