PutContext
指定された名前に基づいてコンテキスト プロパティに値を設定します。指定された名前のエンティティに既存の値がある場合、その値は上書きされます。コンテキスト プロパティには、アカウント ID、アカウント パスワード、サービス名、サービス キー、要求 ID などがあります。
構文
int putContext(Message* message,const char* name,
const char* value)
int putContext(Message* message,const UChar* name,
const UChar* value)
パラメータ
- Message — この関数で操作するメッセージ。
- Name — 指定された値を関連付ける名前。
- Value — 指定された名前に関連付ける値。
結果
0 (正常終了) またはエラー コードを返します。
例
int nRet;
Message* message = createMessage();
nRet = putContext( message, "account.id", "user1") ;
int nRet;
Message* message;
// construct 16-bit string
UChar accountID[32];
char* account="account.id";
UChar accountIDValue[32];
char* accountValue="user1";
u_charsToUChars(account, accountID, strlen(account));
accountID [ strlen(account)]=0;
u_charsToUChars(accountValue, accountIDValue, strlen(accountValue));
accountIDValue [ strlen(accountValue)]=0;
message = createMessage();
nRet = putContext( message, accountID, accountIDValue);