Skip to content

Instantly share code, notes, and snippets.

@noqisofon
Created November 26, 2010 07:08
Show Gist options
  • Save noqisofon/716373 to your computer and use it in GitHub Desktop.
Save noqisofon/716373 to your computer and use it in GitHub Desktop.
INI 用 map ユーティリティーな感じ。
/**
* マップコンテナ dictionary に keyname でアクセスした値が "yes" または "y" な
* ら真を返します。
* @since 2010-09-03
* @see map_about_yes_or_not_existsp
*/
inline bool map_about_yesp( std::map<tstring, tstring>& dictionary,
const tstring& keyname
)
{
tstring value = dictionary[keyname];
return value == INI_VALUE_YES || value.find( INI_VALUE_SHORT_YES );
}
/**
* マップコンテナ dictionary に keyname が無いとき、あるいは keyname でアクセス
* した値が "yes" または "y" なら真を返します。
* @since 2010-09-03
*/
inline bool map_about_yes_or_not_existsp( std::map<tstring, tstring>& dictionary,
const tstring& keyname
)
{
return dictionary.find( keyname ) == dictionary.end()
|| map_about_yesp( dictionary, keyname );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment