| 1 |
|
| 2 |
{***********************************************************************************************************************************} |
| 3 |
{ } |
| 4 |
{ XML データバインディング } |
| 5 |
{ } |
| 6 |
{ 作成日: 2013/01/20 8:47:32 } |
| 7 |
{ 作成元: D:\Dropbox\Delphi-Source\NicoVitanD\Debug\lv120470266_timeshift1.xml } |
| 8 |
{ 設定ファイルの保管先: D:\Dropbox\Delphi-Source\NicoVitanD\Debug\lv120470266_timeshift1.xdb } |
| 9 |
{ } |
| 10 |
{***********************************************************************************************************************************} |
| 11 |
|
| 12 |
unit NicoVitanD_timeshift1; |
| 13 |
|
| 14 |
interface |
| 15 |
|
| 16 |
uses xmldom, XMLDoc, XMLIntf; |
| 17 |
|
| 18 |
type |
| 19 |
|
| 20 |
{ 前方宣言 } |
| 21 |
|
| 22 |
IXMLPacketType = interface; |
| 23 |
IXMLChatType = interface; |
| 24 |
|
| 25 |
{ IXMLPacketType } |
| 26 |
|
| 27 |
IXMLPacketType = interface(IXMLNodeCollection) |
| 28 |
['{C1B4D82C-5F18-405D-B8EF-0AF2D6656236}'] |
| 29 |
{ プロパティ参照関数 } |
| 30 |
function Get_Chat(Index: Integer): IXMLChatType; |
| 31 |
{ メソッドとプロパティ } |
| 32 |
function Add: IXMLChatType; |
| 33 |
function Insert(const Index: Integer): IXMLChatType; |
| 34 |
property Chat[Index: Integer]: IXMLChatType read Get_Chat; default; |
| 35 |
end; |
| 36 |
|
| 37 |
{ IXMLChatType } |
| 38 |
|
| 39 |
IXMLChatType = interface(IXMLNode) |
| 40 |
['{7DC4C283-3141-4F27-9A6B-CAE2FD9AF69B}'] |
| 41 |
{ プロパティ参照関数 } |
| 42 |
function Get_Thread: Integer; |
| 43 |
function Get_Vpos: Integer; |
| 44 |
function Get_Date: Integer; |
| 45 |
function Get_Date_usec: Integer; |
| 46 |
function Get_Mail: Integer; |
| 47 |
function Get_User_id: UnicodeString; |
| 48 |
function Get_Premium: Integer; |
| 49 |
function Get_Anonymity: Integer; |
| 50 |
function Get_Locale: UnicodeString; |
| 51 |
procedure Set_Thread(Value: Integer); |
| 52 |
procedure Set_Vpos(Value: Integer); |
| 53 |
procedure Set_Date(Value: Integer); |
| 54 |
procedure Set_Date_usec(Value: Integer); |
| 55 |
procedure Set_Mail(Value: Integer); |
| 56 |
procedure Set_User_id(Value: UnicodeString); |
| 57 |
procedure Set_Premium(Value: Integer); |
| 58 |
procedure Set_Anonymity(Value: Integer); |
| 59 |
procedure Set_Locale(Value: UnicodeString); |
| 60 |
{ メソッドとプロパティ } |
| 61 |
property Thread: Integer read Get_Thread write Set_Thread; |
| 62 |
property Vpos: Integer read Get_Vpos write Set_Vpos; |
| 63 |
property Date: Integer read Get_Date write Set_Date; |
| 64 |
property Date_usec: Integer read Get_Date_usec write Set_Date_usec; |
| 65 |
property Mail: Integer read Get_Mail write Set_Mail; |
| 66 |
property User_id: UnicodeString read Get_User_id write Set_User_id; |
| 67 |
property Premium: Integer read Get_Premium write Set_Premium; |
| 68 |
property Anonymity: Integer read Get_Anonymity write Set_Anonymity; |
| 69 |
property Locale: UnicodeString read Get_Locale write Set_Locale; |
| 70 |
end; |
| 71 |
|
| 72 |
{ 前方宣言 } |
| 73 |
|
| 74 |
TXMLPacketType = class; |
| 75 |
TXMLChatType = class; |
| 76 |
|
| 77 |
{ TXMLPacketType } |
| 78 |
|
| 79 |
TXMLPacketType = class(TXMLNodeCollection, IXMLPacketType) |
| 80 |
protected |
| 81 |
{ IXMLPacketType } |
| 82 |
function Get_Chat(Index: Integer): IXMLChatType; |
| 83 |
function Add: IXMLChatType; |
| 84 |
function Insert(const Index: Integer): IXMLChatType; |
| 85 |
public |
| 86 |
procedure AfterConstruction; override; |
| 87 |
end; |
| 88 |
|
| 89 |
{ TXMLChatType } |
| 90 |
|
| 91 |
TXMLChatType = class(TXMLNode, IXMLChatType) |
| 92 |
protected |
| 93 |
{ IXMLChatType } |
| 94 |
function Get_Thread: Integer; |
| 95 |
function Get_Vpos: Integer; |
| 96 |
function Get_Date: Integer; |
| 97 |
function Get_Date_usec: Integer; |
| 98 |
function Get_Mail: Integer; |
| 99 |
function Get_User_id: UnicodeString; |
| 100 |
function Get_Premium: Integer; |
| 101 |
function Get_Anonymity: Integer; |
| 102 |
function Get_Locale: UnicodeString; |
| 103 |
procedure Set_Thread(Value: Integer); |
| 104 |
procedure Set_Vpos(Value: Integer); |
| 105 |
procedure Set_Date(Value: Integer); |
| 106 |
procedure Set_Date_usec(Value: Integer); |
| 107 |
procedure Set_Mail(Value: Integer); |
| 108 |
procedure Set_User_id(Value: UnicodeString); |
| 109 |
procedure Set_Premium(Value: Integer); |
| 110 |
procedure Set_Anonymity(Value: Integer); |
| 111 |
procedure Set_Locale(Value: UnicodeString); |
| 112 |
end; |
| 113 |
|
| 114 |
{ グローバル関数 } |
| 115 |
|
| 116 |
function Getpacket(Doc: IXMLDocument): IXMLPacketType; |
| 117 |
function Loadpacket(const FileName: string): IXMLPacketType; |
| 118 |
function Newpacket: IXMLPacketType; |
| 119 |
|
| 120 |
const |
| 121 |
TargetNamespace = ''; |
| 122 |
|
| 123 |
implementation |
| 124 |
|
| 125 |
{ グローバル関数 } |
| 126 |
|
| 127 |
function Getpacket(Doc: IXMLDocument): IXMLPacketType; |
| 128 |
begin |
| 129 |
Result := Doc.GetDocBinding('packet', TXMLPacketType, TargetNamespace) as IXMLPacketType; |
| 130 |
end; |
| 131 |
|
| 132 |
function Loadpacket(const FileName: string): IXMLPacketType; |
| 133 |
begin |
| 134 |
Result := LoadXMLDocument(FileName).GetDocBinding('packet', TXMLPacketType, TargetNamespace) as IXMLPacketType; |
| 135 |
end; |
| 136 |
|
| 137 |
function Newpacket: IXMLPacketType; |
| 138 |
begin |
| 139 |
Result := NewXMLDocument.GetDocBinding('packet', TXMLPacketType, TargetNamespace) as IXMLPacketType; |
| 140 |
end; |
| 141 |
|
| 142 |
{ TXMLPacketType } |
| 143 |
|
| 144 |
procedure TXMLPacketType.AfterConstruction; |
| 145 |
begin |
| 146 |
RegisterChildNode('chat', TXMLChatType); |
| 147 |
ItemTag := 'chat'; |
| 148 |
ItemInterface := IXMLChatType; |
| 149 |
inherited; |
| 150 |
end; |
| 151 |
|
| 152 |
function TXMLPacketType.Get_Chat(Index: Integer): IXMLChatType; |
| 153 |
begin |
| 154 |
Result := List[Index] as IXMLChatType; |
| 155 |
end; |
| 156 |
|
| 157 |
function TXMLPacketType.Add: IXMLChatType; |
| 158 |
begin |
| 159 |
Result := AddItem(-1) as IXMLChatType; |
| 160 |
end; |
| 161 |
|
| 162 |
function TXMLPacketType.Insert(const Index: Integer): IXMLChatType; |
| 163 |
begin |
| 164 |
Result := AddItem(Index) as IXMLChatType; |
| 165 |
end; |
| 166 |
|
| 167 |
{ TXMLChatType } |
| 168 |
|
| 169 |
function TXMLChatType.Get_Thread: Integer; |
| 170 |
begin |
| 171 |
Result := AttributeNodes['thread'].NodeValue; |
| 172 |
end; |
| 173 |
|
| 174 |
procedure TXMLChatType.Set_Thread(Value: Integer); |
| 175 |
begin |
| 176 |
SetAttribute('thread', Value); |
| 177 |
end; |
| 178 |
|
| 179 |
function TXMLChatType.Get_Vpos: Integer; |
| 180 |
begin |
| 181 |
Result := AttributeNodes['vpos'].NodeValue; |
| 182 |
end; |
| 183 |
|
| 184 |
procedure TXMLChatType.Set_Vpos(Value: Integer); |
| 185 |
begin |
| 186 |
SetAttribute('vpos', Value); |
| 187 |
end; |
| 188 |
|
| 189 |
function TXMLChatType.Get_Date: Integer; |
| 190 |
begin |
| 191 |
Result := AttributeNodes['date'].NodeValue; |
| 192 |
end; |
| 193 |
|
| 194 |
procedure TXMLChatType.Set_Date(Value: Integer); |
| 195 |
begin |
| 196 |
SetAttribute('date', Value); |
| 197 |
end; |
| 198 |
|
| 199 |
function TXMLChatType.Get_Date_usec: Integer; |
| 200 |
begin |
| 201 |
Result := AttributeNodes['date_usec'].NodeValue; |
| 202 |
end; |
| 203 |
|
| 204 |
procedure TXMLChatType.Set_Date_usec(Value: Integer); |
| 205 |
begin |
| 206 |
SetAttribute('date_usec', Value); |
| 207 |
end; |
| 208 |
|
| 209 |
function TXMLChatType.Get_Mail: Integer; |
| 210 |
begin |
| 211 |
Result := AttributeNodes['mail'].NodeValue; |
| 212 |
end; |
| 213 |
|
| 214 |
procedure TXMLChatType.Set_Mail(Value: Integer); |
| 215 |
begin |
| 216 |
SetAttribute('mail', Value); |
| 217 |
end; |
| 218 |
|
| 219 |
function TXMLChatType.Get_User_id: UnicodeString; |
| 220 |
begin |
| 221 |
Result := AttributeNodes['user_id'].Text; |
| 222 |
end; |
| 223 |
|
| 224 |
procedure TXMLChatType.Set_User_id(Value: UnicodeString); |
| 225 |
begin |
| 226 |
SetAttribute('user_id', Value); |
| 227 |
end; |
| 228 |
|
| 229 |
function TXMLChatType.Get_Premium: Integer; |
| 230 |
begin |
| 231 |
Result := AttributeNodes['premium'].NodeValue; |
| 232 |
end; |
| 233 |
|
| 234 |
procedure TXMLChatType.Set_Premium(Value: Integer); |
| 235 |
begin |
| 236 |
SetAttribute('premium', Value); |
| 237 |
end; |
| 238 |
|
| 239 |
function TXMLChatType.Get_Anonymity: Integer; |
| 240 |
begin |
| 241 |
Result := AttributeNodes['anonymity'].NodeValue; |
| 242 |
end; |
| 243 |
|
| 244 |
procedure TXMLChatType.Set_Anonymity(Value: Integer); |
| 245 |
begin |
| 246 |
SetAttribute('anonymity', Value); |
| 247 |
end; |
| 248 |
|
| 249 |
function TXMLChatType.Get_Locale: UnicodeString; |
| 250 |
begin |
| 251 |
Result := AttributeNodes['locale'].Text; |
| 252 |
end; |
| 253 |
|
| 254 |
procedure TXMLChatType.Set_Locale(Value: UnicodeString); |
| 255 |
begin |
| 256 |
SetAttribute('locale', Value); |
| 257 |
end; |
| 258 |
|
| 259 |
end. |