TwlIPL/build/tools/MasterEditorTWL/MasterEditorTWL/utility.h
nishikawa_takeshi 59e3269b2e マスタエディタ:MRCデバッグで出たバグを修正。
git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/TwlIPL/trunk@2546 b08762b0-b915-fc4b-9d8c-17b2551a87ff
2008-09-24 10:33:46 +00:00

137 lines
3.5 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#pragma once
// 共用ライブラリ・クラスの宣言
#include <twl/types.h>
#include <cstring>
#include <cstdio>
namespace MasterEditorTWL
{
// -------------------------------------------------------------------
// functions
// -------------------------------------------------------------------
//
// String を char 配列に格納
//
// @arg [out] 格納先
// @arg [in] 格納元
// @arg [in] 文字列長
// @arg [in] 余りを埋める padding
//
void setStringToChars( char *pDst, System::String ^hSrc, const System::Int32 nMax, const System::SByte pad );
//
// ROMヘッダ中のROM容量設定バイトからROM容量を表す文字列を取得
//
// @arg [in] ROM容量設定バイト
//
// @ret 文字列(単位つき)
//
System::String^ transRomSizeToString( System::Byte ^byte );
//
// サイズから単位つきの文字列を取得
//
// @arg [in] バイト数
//
// @ret 文字列(単位つき)
//
System::String^ transSizeToString( System::UInt32 ^size );
//
// ペアレンタルコントロールの各団体の設定可能年齢を取得する
//
// @arg [in] 団体
//
cli::array<System::Byte>^ getOgnRatingAges( int ogn );
//
// ペアレンタルコントロールの各団体の団体名を取得する
//
// @arg [in] 団体
//
System::String^ getOgnName( int ogn );
//
// バイト列に特定のパターンが含まれるかどうかマッチングする
//
// @arg [in] テキスト
// [in] テキストの長さ
// [in] パターン
// [in] パターンの長さ
// [in] テキストの終端まで調べた時点でテキストが途中までマッチしていた場合を成功とみなすか
//
// @ret マッチしたテキストのインデックスをリストで返す。
//
System::Collections::Generic::List<u32>^ patternMatch(
const u8 *text, const u32 textLen, const u8 *pattern, const u32 patternLen, const System::Boolean enableLast );
//
// ファイルにバイト列のパターンが含まれるかどうかマッチングする
//
// @arg [in] マッチ対象となるファイルポインタ
// @arg [in] パターン
// @arg [in] パターンの長さ
//
// @ret マッチしたテキストのインデックスをリストで返す。
// 最後までマッチした場合のみ成功したとみなす。
//
System::Collections::Generic::List<u32>^ patternMatch( FILE *fp, const u8 *pattern, const u32 patternLen );
//
// XMLのルートードから指定した名前のタグを検索して返す
//
// @arg [in] XMLのルートード
// @arg [in] タグ名
//
// @ret 検索でマッチしたときノードを返す。ないときは nullptr。
// ただし、最初にマッチしたもののみ返す
//
System::Xml::XmlNode^ searchXmlNode( System::Xml::XmlElement ^root, System::String ^tag );
//
// タグを検索してそのテキストが指定したテキストと一致するか調べる
//
// @arg [in] XMLのルートード
// @arg [in] タグ名
// @arg [in] 値
//
// @ret 一致するときtrue。一致しないとき、タグが存在しないときはfalse。
//
System::Boolean isXmlEqual( System::Xml::XmlElement ^root, System::String ^tag, System::String ^val );
//
// タグを検索してそのテキストを返す
//
// @arg [in] XMLのルートード
// @arg [in] タグのXPath
//
// @ret テキストが存在するときそのテキストを返す。存在しないときnullptr。
//
System::String^ getXPathText( System::Xml::XmlElement ^root, System::String ^xpath );
//
// XMLにタグを追加する
//
// @arg [in] XMLドキュメント
// @arg [in] 親ノード
// @arg [in] タグ名
// @arg [in] テキスト
//
void appendXmlTag( System::Xml::XmlDocument ^doc, System::Xml::XmlElement ^parent,
System::String ^tag, System::String ^text );
//
// ビット数をカウントする
//
// @arg [in] 値
//
// @ret ビット数
//
u32 countBits( const u32 val );
} // end of namespace MasterEditorTWL