40 printf(
"\nProxy Exercise\n");
45 printf(
" Getting proxy object...\n");
48 printf(
" Calling Dowork() on proxy...\n");
52 success = proxyObject->
DoWork(&output);
55 printf(
" Output from proxy = \"%s\"\n", output.
string);
60 printf(
" Calling Dowork() on proxy...\n");
64 success = proxyObject->
DoWork(&output);
67 printf(
" Output from proxy = \"%s\"\n", output.
string);
73 printf(
" Calling Dowork() on proxy...\n");
77 success = proxyObject->
DoWork(&output);
80 printf(
" Output from proxy = \"%s\"\n", output.
string);
void Proxy_Exercise(void)
Example of using the Proxy design pattern.
IWorkByProxy * GetProxyService(void)
Obtain the proxy service.
Declaration of the proxy service, accessed through the GetProxyService() function,...
Declaration of the Proxy_Exercise() function as used in the Proxy Pattern.
void DynamicString_Clear(DynamicString *string)
Clear a DynamicString object, releasing any allocated memory. Resets to an empty string.
void DynamicString_Initialize(DynamicString *string)
Initialize a DynamicString object to an empty string.
bool DynamicString_Set(DynamicString *string, const char *s)
Set the DynamicString object to the specified string, replacing whatever is in the DynamicString obje...
Declaration of the DynamicString structure and supporting functions to work with dynamic strings.
Represents a string that can be grown dynamically.
char * string
The string that can grow.
Represents what can be done on the proxy object. This same interface is implemented on the real objec...
bool(* DoWork)(DynamicString *someArgument)
Does some work on the given argument and updates the given argument.