ShopList* pList; pSupplies->SetShops(&pList);
ShopList
ShopList pList; pSupplies.SetShops(out pList);
out
ShopListItem Item; Item.ShopName = L"the name of the shop"; Item.ShopURL = L"http://www.theshop.com"; pList->Insert(NULL, &Item); const ShopListItem* pItem; pList->Get(0, &pItem);
ShopListItem
"the name of the shop"
"http://www.theshop.com"
NULL
const
ShopListItem Item = new ShopListItem(); Item.ShopName = "the name of the shop"; Item.ShopURL = "http://www.theshop.com"; uint vl; pList.Insert(out vl, Item); pList.Get(0, out Item);
new
uint
#include "pch.h" void writeList(WSupplies* pSupplies) { // Shops ShopList* pList; pSupplies->SetShops(&pList); ShopListItem Item; // ShopName wprintf(L"Shop name:\n"); std::wstring input1; getline(std::wcin, input1); Item.ShopName = input1.c_str(); // ShopURL wprintf(L"Shop URL:\n"); std::wstring input2; getline(std::wcin, input2); Item.ShopURL = input2.c_str(); pList->Insert(NULL, &Item); // Store pSupplies->Store(); // we added an item to the list // Execute HRESULT hRes; if(FAILED(hRes = pSupplies->GetDomain()->Execute(Transaction::Store))) { wprintf(L"Domain failed to execute the transaction (0x%x)", hRes); } }
#include
"pch.h"
void
WSupplies
// Shops
// ShopName
"Shop name:\n"
wstring
// ShopURL
"Shop URL:\n"
// Store
// we added an item to the list
// Execute
HRESULT
if
FAILED
Transaction
"Domain failed to execute the transaction (0x%x)"
using System; using DataFoundationAccess; namespace TutorialCs { partial class Tutorial { public static void writeList(WSupplies pSupplies) { // Shops ShopList pList; pSupplies.SetShops(out pList); ShopListItem Item = new ShopListItem(); // ShopName Console.WriteLine("Shop name:"); string input1 = Console.ReadLine(); Item.ShopName = input1; // ShopURL Console.WriteLine("Shop URL:"); string input2 = Console.ReadLine(); Item.ShopName = input2; uint _i; pList.Insert(out _i, Item); // Store pSupplies.Store(Transaction.Store); // we added an item to the list // Execute int hRes; if(0 > (hRes = pSupplies.GetDomain().Execute(Transaction.Store))) { Console.WriteLine("Domain failed to execute the transaction (0x{0:x})", hRes); } } } }
using
namespace
partial
class
Tutorial
public
static
"Shop name:"
string
"Shop URL:"
int
"Domain failed to execute the transaction (0x{0:x})"
#include "pch.h" void readList(WSupplies* pSupplies) { HRESULT hRes; const ShopList* pList; if(S_OK == (hRes = pSupplies->GetShops(&pList))) { wprintf(L"All ShopList items (%i)\n\n", pList->GetLength()); for(UINT32 i = 0; i < pList->GetLength(); i++) { const ShopListItem* Item; pList->Get(i, &Item); wprintf(L"Shop %i\n", i); wprintf(L"Shop Name: %s\n", Item->ShopName); wprintf(L"Shop Url: %s\n\n", Item->ShopURL); } } else wprintf(L"Cannot read shop list (0x%x)\n", hRes); }
S_OK
"All ShopList items (%i)\n\n"
for
UINT32
i
"Shop %i\n"
"Shop Name: %s\n"
"Shop Url: %s\n\n"
else
"Cannot read shop list (0x%x)\n"
using System; using DataFoundationAccess; namespace TutorialCs { partial class Tutorial { public static void readList(WSupplies pSupplies) { int hRes; ShopList pList; if (0 == (hRes = pSupplies.GetShops(out pList))) { Console.WriteLine("All ShopList items ({0})\n", pList.GetLength()); for (UInt32 i = 0; i < pList.GetLength(); i++) { ShopListItem Item; pList.Get(i, out Item); Console.WriteLine("Shop {0:F}", i); Console.WriteLine("Shop Name: {0}", Item.ShopName); Console.WriteLine("Shop URL: {0}\n", Item.ShopURL); } } else Console.WriteLine("Cannot read shop list (0x{0:x})", hRes); } } }
"All ShopList items ({0})\n"
UInt32
"Shop {0:F}"
"Shop Name: {0}"
"Shop URL: {0}\n"
"Cannot read shop list (0x{0:x})"