亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? datafile.cpp

?? Convert Interface on a embedded System
?? CPP
?? 第 1 頁 / 共 2 頁
字號(hào):
	return (pKey == NULL) ? t_Str("") : pKey->szValue;
}

// GetString
// Returns the key value as a t_Str object. A return value of
// t_Str("") indicates that the key could not be found.
t_Str CDataFile::GetString(t_Str szKey, t_Str szSection)
{
	return GetValue(szKey, szSection);
}

// GetFloat
// Returns the key value as a float type. Returns FLT_MIN if the key is
// not found.
float CDataFile::GetFloat(t_Str szKey, t_Str szSection)
{
	t_Str szValue = GetValue(szKey, szSection);

	if ( szValue.size() == 0 )
		return FLT_MIN;

	return (float)atof( szValue.c_str() );
}

// GetInt
// Returns the key value as an integer type. Returns INT_MIN if the key is
// not found.
int	CDataFile::GetInt(t_Str szKey, t_Str szSection)
{
	t_Str szValue = GetValue(szKey, szSection);

	if ( szValue.size() == 0 )
		return INT_MIN;

	return atoi( szValue.c_str() );
}

// GetBool
// Returns the key value as a bool type. Returns false if the key is
// not found.
bool CDataFile::GetBool(t_Str szKey, t_Str szSection)
{
	bool bValue = false;
	t_Str szValue = GetValue(szKey, szSection);

	if ( szValue.find("1") == 0 
		|| CompareNoCase(szValue, "true") 
		|| CompareNoCase(szValue, "yes") )
	{
		bValue = true;
	}

	return bValue;
}

// DeleteSection
// Delete a specific section. Returns false if the section cannot be 
// found or true when sucessfully deleted.
bool CDataFile::DeleteSection(t_Str szSection)
{
	SectionItor s_pos;

	for (s_pos = m_Sections.begin(); s_pos != m_Sections.end(); s_pos++)
	{
		if ( CompareNoCase( (*s_pos).szName, szSection ) == 0 ) 
		{
			m_Sections.erase(s_pos);
			return true;
		}
	}

	return false;
}

// DeleteKey
// Delete a specific key in a specific section. Returns false if the key
// cannot be found or true when sucessfully deleted.
bool CDataFile::DeleteKey(t_Str szKey, t_Str szFromSection)
{
	KeyItor k_pos;
	t_Section* pSection;

	if ( (pSection = GetSection(szFromSection)) == NULL )
		return false;

	for (k_pos = pSection->Keys.begin(); k_pos != pSection->Keys.end(); k_pos++)
	{
		if ( CompareNoCase( (*k_pos).szKey, szKey ) == 0 )
		{
			pSection->Keys.erase(k_pos);
			return true;
		}
	}

	return false;
}

// CreateKey
// Given a key, a value and a section, this function will attempt to locate the
// Key within the given section, and if it finds it, change the keys value to
// the new value. If it does not locate the key, it will create a new key with
// the proper value and place it in the section requested.
bool CDataFile::CreateKey(t_Str szKey, t_Str szValue, t_Str szComment, t_Str szSection)
{
	bool bAutoKey = (m_Flags & AUTOCREATE_KEYS) == AUTOCREATE_KEYS;
	bool bReturn  = false;

	m_Flags |= AUTOCREATE_KEYS;

	bReturn = SetValue(szKey, szValue, szComment, szSection);

	if ( !bAutoKey )
		m_Flags &= ~AUTOCREATE_KEYS;

	return bReturn;
}


// CreateSection
// Given a section name, this function first checks to see if the given section
// allready exists in the list or not, if not, it creates the new section and
// assigns it the comment given in szComment.  The function returns true if
// sucessfully created, or false otherwise. 
bool CDataFile::CreateSection(t_Str szSection, t_Str szComment)
{
	t_Section* pSection = GetSection(szSection);

	if ( pSection )
	{
		Report(E_INFO, "[CDataFile::CreateSection] Section <%s> allready exists. Aborting.", szSection.c_str());
		return false;
	}

	pSection = new t_Section;

	pSection->szName = szSection;
	pSection->szComment = szComment;
	m_Sections.push_back(*pSection);
	m_bDirty = true;

	return true;
}

// CreateSection
// Given a section name, this function first checks to see if the given section
// allready exists in the list or not, if not, it creates the new section and
// assigns it the comment given in szComment.  The function returns true if
// sucessfully created, or false otherwise. This version accpets a KeyList 
// and sets up the newly created Section with the keys in the list.
bool CDataFile::CreateSection(t_Str szSection, t_Str szComment, KeyList Keys)
{
	if ( !CreateSection(szSection, szComment) )
		return false;

	t_Section* pSection = GetSection(szSection);

	if ( !pSection )
		return false;

	KeyItor k_pos;

	pSection->szName = szSection;
	for (k_pos = Keys.begin(); k_pos != Keys.end(); k_pos++)
	{
		t_Key* pKey = new t_Key;
		pKey->szComment = (*k_pos).szComment;
		pKey->szKey = (*k_pos).szKey;
		pKey->szValue = (*k_pos).szValue;

		pSection->Keys.push_back(*pKey);
	}

	m_Sections.push_back(*pSection);
	m_bDirty = true;

	return true;
}

// SectionCount
// Simply returns the number of sections in the list.
int CDataFile::SectionCount() 
{ 
	return m_Sections.size(); 
}

// KeyCount
// Returns the total number of keys contained within all the sections.
int CDataFile::KeyCount()
{
	int nCounter = 0;
	SectionItor s_pos;

	for (s_pos = m_Sections.begin(); s_pos != m_Sections.end(); s_pos++)
		nCounter += (*s_pos).Keys.size();

	return nCounter;
}


// Protected Member Functions ///////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////

// GetKey
// Given a key and section name, looks up the key and if found, returns a
// pointer to that key, otherwise returns NULL.
t_Key*	CDataFile::GetKey(t_Str szKey, t_Str szSection)
{
	KeyItor k_pos;
	t_Section* pSection;

	// Since our default section has a name value of t_Str("") this should
	// always return a valid section, wether or not it has any keys in it is
	// another matter.
	if ( (pSection = GetSection(szSection)) == NULL )
		return NULL;

	for (k_pos = pSection->Keys.begin(); k_pos != pSection->Keys.end(); k_pos++)
	{
		if ( CompareNoCase( (*k_pos).szKey, szKey ) == 0 )
			return (t_Key*)&(*k_pos);
	}

	return NULL;
}

// GetSection
// Given a section name, locates that section in the list and returns a pointer
// to it. If the section was not found, returns NULL
t_Section* CDataFile::GetSection(t_Str szSection)
{
	SectionItor s_pos;

	for (s_pos = m_Sections.begin(); s_pos != m_Sections.end(); s_pos++)
	{
		if ( CompareNoCase( (*s_pos).szName, szSection ) == 0 ) 
			return (t_Section*)&(*s_pos);
	}

	return NULL;
}


t_Str CDataFile::CommentStr(t_Str szComment)
{
	t_Str szNewStr = t_Str("");

	Trim(szComment);

        if ( szComment.size() == 0 )
          return szComment;
	
	if ( szComment.find_first_of(CommentIndicators) != 0 )
	{
		szNewStr = CommentIndicators[0];
		szNewStr += " ";
	}

	szNewStr += szComment;

	return szNewStr;
}



// Utility Functions ////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////

// GetNextWord
// Given a key +delimiter+ value string, pulls the key name from the string,
// deletes the delimiter and alters the original string to contain the
// remainder.  Returns the key
t_Str GetNextWord(t_Str& CommandLine)
{
	int nPos = CommandLine.find_first_of(EqualIndicators);
	t_Str sWord = t_Str("");

	if ( nPos > -1 )
	{
		sWord = CommandLine.substr(0, nPos);
		CommandLine.erase(0, nPos+1);
	}
	else
	{
		sWord = CommandLine;
		CommandLine = t_Str("");
	}

	Trim(sWord);
	return sWord;
}


// CompareNoCase
// it's amazing what features std::string lacks.  This function simply
// does a lowercase compare against the two strings, returning 0 if they
// match.
int CompareNoCase(t_Str str1, t_Str str2)
{
#ifdef WIN32
	return stricmp(str1.c_str(), str2.c_str());	
#else
//	return _strcasecmp(str1.c_str(), str2.c_str());
	return _stricmp(str1.c_str(), str2.c_str());
#endif
}

// Trim
// Trims whitespace from both sides of a string.
void Trim(t_Str& szStr)
{
	t_Str szTrimChars = WhiteSpace;
	
	szTrimChars += EqualIndicators;
	int nPos, rPos;

	// trim left
	nPos = szStr.find_first_not_of(szTrimChars);

	if ( nPos > 0 )
		szStr.erase(0, nPos);

	// trim right and return
	nPos = szStr.find_last_not_of(szTrimChars);
	rPos = szStr.find_last_of(szTrimChars);

	if ( rPos > nPos && rPos > -1)
		szStr.erase(rPos, szStr.size()-rPos);
}

// WriteLn
// Writes the formatted output to the file stream, returning the number of
// bytes written.
int WriteLn(fstream& stream, char* fmt, ...)
{
	char buf[MAX_BUFFER_LEN];
	int nLength;
	t_Str szMsg;

	memset(buf, 0, MAX_BUFFER_LEN);
	va_list args;

	va_start (args, fmt);
	nLength = _vsnprintf(buf, MAX_BUFFER_LEN, fmt, args);
	va_end (args);


	if ( buf[nLength] != '\n' && buf[nLength] != '\r' )
		buf[nLength++] = '\n';


	stream.write(buf, nLength);

	return nLength;
}

// Report
// A simple reporting function. Outputs the report messages to stdout
// This is a dumb'd down version of a simmilar function of mine, so if 
// it looks like it should do more than it does, that's why...
void Report(e_DebugLevel DebugLevel, char *fmt, ...)
{
	char buf[MAX_BUFFER_LEN];
	int nLength;
	t_Str szMsg;

	va_list args;

	memset(buf, 0, MAX_BUFFER_LEN);

	va_start (args, fmt);
	nLength = _vsnprintf(buf, MAX_BUFFER_LEN, fmt, args);
	va_end (args);


	if ( buf[nLength] != '\n' && buf[nLength] != '\r' )
		buf[nLength++] = '\n';


	switch ( DebugLevel )
	{
		case E_DEBUG:
			szMsg = "<debug> ";
			break;
		case E_INFO:
			szMsg = "<info> ";
			break;
		case E_WARN:
			szMsg = "<warn> ";
			break;
		case E_ERROR:
			szMsg = "<error> ";
			break;
		case E_FATAL:
			szMsg = "<fatal> ";
			break;
		case E_CRITICAL:
			szMsg = "<critical> ";
			break;
	}


	szMsg += buf;


#ifdef WIN32
	OutputDebugString(szMsg.c_str());
#endif

	printf(szMsg.c_str());

}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲一区二区三区爽爽爽爽爽| 欧美日韩精品欧美日韩精品一综合| 欧美国产综合色视频| 99精品视频免费在线观看| 全国精品久久少妇| 国产精品青草综合久久久久99| 色综合视频在线观看| 久草热8精品视频在线观看| 国产精品免费免费| 91啪九色porn原创视频在线观看| 精品一区二区综合| 一区二区三区四区五区视频在线观看| 精品免费视频.| 一本久久a久久精品亚洲| 日韩国产精品大片| 亚洲综合另类小说| 久久久久久免费网| 欧美xxxxx牲另类人与| 色欧美片视频在线观看 | 亚洲视频一二三区| 欧美一区二区人人喊爽| 成人黄色大片在线观看| 国内不卡的二区三区中文字幕 | 欧美另类久久久品| 成人三级伦理片| 日韩国产成人精品| 亚洲成人www| ㊣最新国产の精品bt伙计久久| 久久欧美一区二区| 正在播放一区二区| 91久久久免费一区二区| 99久久精品免费看国产免费软件| 麻豆成人综合网| 日本v片在线高清不卡在线观看| 最好看的中文字幕久久| 久久久久国产精品人| 久久日韩精品一区二区五区| 91麻豆精品国产91久久久更新时间| 欧美在线一区二区| 色综合久久综合| 成人av动漫网站| 91免费在线看| www.欧美.com| 色综合天天综合网国产成人综合天 | 国产成人亚洲综合a∨猫咪| 日韩精品亚洲专区| 亚洲午夜免费视频| 精品国产免费视频| 国产一区二区电影| 精品一区二区在线免费观看| 久久99热狠狠色一区二区| 无码av中文一区二区三区桃花岛| 国产欧美一区二区三区沐欲| 中国av一区二区三区| 久久久激情视频| 综合激情成人伊人| 亚洲欧洲性图库| 久久久99精品久久| 亚洲视频中文字幕| 亚洲嫩草精品久久| 日本vs亚洲vs韩国一区三区二区 | 日本精品一区二区三区高清 | 国产高清一区日本| 国产精品一二二区| av网站免费线看精品| 色88888久久久久久影院野外| 色激情天天射综合网| 欧美日韩久久久久久| 欧美一区二区成人| 久久久精品黄色| 日韩美女视频一区二区| 一区二区三区国产精品| 裸体在线国模精品偷拍| 国产在线国偷精品产拍免费yy| av爱爱亚洲一区| 在线看日韩精品电影| 欧美日韩高清影院| 久久亚洲精品小早川怜子| 国产日本欧美一区二区| 亚洲一区视频在线| 蜜桃在线一区二区三区| 男女男精品网站| www.视频一区| 欧美精品色一区二区三区| 久久精品日韩一区二区三区| 自拍av一区二区三区| 亚洲最大成人网4388xx| 激情文学综合插| 99vv1com这只有精品| 欧美日韩精品免费观看视频 | 欧美日韩一区二区在线观看视频| 色偷偷成人一区二区三区91| 日韩三级中文字幕| 国产精品无码永久免费888| 天天免费综合色| 亚洲欧美一区二区三区极速播放| 久久婷婷色综合| 天堂久久久久va久久久久| 国产在线精品一区在线观看麻豆| 在线免费观看日本欧美| 久久你懂得1024| 午夜精品久久久久久久久久| 99久久精品情趣| 欧美成人a∨高清免费观看| 亚洲免费在线电影| 久久精品免费观看| 成人激情文学综合网| www久久精品| 亚洲在线中文字幕| 91视频国产资源| 欧美大片日本大片免费观看| 一区二区成人在线观看| 国产伦精品一区二区三区免费迷| 欧洲色大大久久| 日韩理论片网站| 九九**精品视频免费播放| 欧洲国内综合视频| 国产午夜精品福利| 亚洲成人777| 欧美午夜电影在线播放| 国产日韩综合av| 国产精品一二一区| 日韩欧美一区中文| 日本中文字幕一区| 欧美亚洲日本一区| 欧美日韩免费一区二区三区| 一区二区三区欧美久久| 成人亚洲一区二区一| 国产欧美一区二区在线观看| 日韩电影在线观看电影| 欧美精品一卡两卡| 亚洲成人手机在线| 国产一区二区三区在线观看免费 | 欧美三区免费完整视频在线观看| 亚洲精品自拍动漫在线| 极品少妇xxxx精品少妇| 欧美一区二区三区四区视频| 成人午夜av影视| 丝袜诱惑制服诱惑色一区在线观看| 国产成人精品免费| 久久青草国产手机看片福利盒子 | 国产成人99久久亚洲综合精品| 日韩欧美美女一区二区三区| 亚洲地区一二三色| 欧美日韩欧美一区二区| 亚洲国产日韩综合久久精品| 欧美日韩国产欧美日美国产精品| 亚洲日本丝袜连裤袜办公室| 韩国三级中文字幕hd久久精品| 精品国产自在久精品国产| 免费在线观看视频一区| 精品88久久久久88久久久| 麻豆国产欧美一区二区三区| 久久美女高清视频| 国产一区二区导航在线播放| 亚洲国产精品国自产拍av| 国产精品91一区二区| 日韩一区二区高清| 国产福利不卡视频| 国产精品水嫩水嫩| 欧美午夜在线一二页| 亚洲国产中文字幕| 精品国产露脸精彩对白| 国产高清亚洲一区| 久久久精品国产99久久精品芒果| 97久久精品人人爽人人爽蜜臀| 亚洲视频1区2区| 欧美一区二区视频免费观看| 久久精品国产99久久6| 中文字幕欧美日本乱码一线二线| 成人污污视频在线观看| 夜夜精品浪潮av一区二区三区| 欧美久久久影院| 玖玖九九国产精品| 亚洲免费观看高清完整版在线| 91久久精品一区二区三| 久久电影网站中文字幕| 久久精品一区四区| 欧美专区亚洲专区| 久国产精品韩国三级视频| 久久这里只有精品视频网| 色婷婷亚洲一区二区三区| 亚洲国产美国国产综合一区二区| 日韩精品专区在线影院观看| 成人午夜视频免费看| 日韩毛片一二三区| 欧美亚洲一区三区| 美女网站一区二区| 99精品视频一区| 亚洲男人的天堂av| 精品少妇一区二区三区在线播放| 粉嫩aⅴ一区二区三区四区五区 | 成人动漫视频在线| 亚洲一区二区视频| 精品国产91九色蝌蚪| 欧美日韩国产欧美日美国产精品| 国产乱码精品1区2区3区| 婷婷久久综合九色综合绿巨人| 久久天堂av综合合色蜜桃网| 欧美日韩极品在线观看一区|