Vvidget Code Reference Manual

Vvidget Code > API > Mac OS X > Client > Input String Constructor

The Input String Constructor is defined by the VC_Input_String_Constructor class. An instance of that class is used to aid in the construction of a Dictionary which defines a graph.


Linkage

Add the Input String Constructor functionality to your project by adding the VvidgetCode framework.

Definition:/Library/Frameworks/VvidgetCode.framework/Headers/VC_Input_String_Constructor.h
Client Framework:/Library/Frameworks/VvidgetCode.framework
Shared Frameworks:/Library/Frameworks/Vvidget_*.framework
Embedded Frameworks:/Library/Vvidget/EmbeddedFrameworks/Vvidget_*.framework

If you use the Embedded Frameworks then you will need to add a build copy phase to your project to copy the Vvidget Frameworks into your application bundle. See Deploy for details. If you use an external server then you need only link to the Client Framework which implements a client interface to another process (the Peer Visual Server).


Method Definitions

The following defines each method that is used with an object (instance) of the VC_Input_String_Constructor type.

- (id)init

This method instantiates an input string constructor. You do not actually use this method, instead retrieve the input string constructor from a client view as follows:

VC_Input_String_Constructor *constructor;
constructor = [[graphView get_VC_input_string_constructor];

The referenced object is assigned to the symbol constructor and that is the symbol you refer to in subsequent calling code.

- (void)VC_reset

Once you use an input string constructor to make a graph then its state (key and value pairs) is complete. To use it again you must reset it (or alternatively release it and make a new one). The following resets the input string constructor to its initial state (the state it had when you first created it).

[constructor VC_reset];

Since the constructor is always a reference from the view you will not want to release it and you shall always want to reset the constructor instead.

- (void)VC_append_key:(const char *)a_key_c_string string_value:(NSString *)a_value

After making (or resetting) a constructor you will need to add keys and values to it. This method adds the key a_key_c_string with value a_value of type NSString to the constructor. For example, the following adds an entry to the dictionary which sets the state of the dictionary so that it produces a line chart.

[constructor VC_append_key:"chart_type" string_value:@"line"];

- (void)VC_append_key:(const char *)a_key_c_string unsigned_value:(unsigned)a_value

This method adds the key a_key_c_string with value a_value of type unsigned to the constructor.

- (void)dealloc

This method deallocates the constructor. Never release an input string constructor since all constructors are owned by a client view. The obvious exceptions are if you decide to retain the constructor or if you (surreptitiously) made your own constructor and substituted that one in the client view. Another exception is when you use a Client State (as with a plug-in) and bypass the view mechanism entirely. But, those exceptions are not part of the description of this Client API.


Actual Use

The following is a complete calling sequence of a input string constructor and makes a line graph state in dictionary form.

constructor = [graphView get_VC_input_string_constructor]
[constructor VC_reset];
[constructor VC_append_key:"vvidgetcode_deployment_license" string_value:@"embedded 1d65ch78f09aadR06464fY6"];
[constructor VC_append_key:"chart_type" string_value:@"line"];
[constructor VC_append_key:"chart_subtype" string_value:@"linear"];
[constructor VC_append_key:"chart_format_type" string_value:@"default"];
[constructor VC_append_key:"title" string_value:@"Vvidget Code Example Project"];
[constructor VC_append_key:"x_title" string_value:@"My X Title"];
[constructor VC_append_key:"y_title" string_value:@"My Y Title"];
[constructor VC_append_key:"data_1" string_value:"1 2 2 4 3 6"];
[constructor VC_append_key:"line_color" string_value:@"0000FF"];

As you can see, the API for the constructor is just enough to permit the function of defining a key value state and nothing more. In other words, the API does not define a graph, rather it simply defines a handful of methods to make a dictionary. For definitions of state see the section Dictionary. Now that you have a fully setup constructor you will need to do something with it. The prescription is to inform a view to transmit the contents of the input string constructor to a server for processing. You do that with this call:

[graphView VCN_update_using_input_string_constructor];

At this point, the explanation of the input string constructor is complete. The input string constructor simply appends keys and values to itself and the view does the rest. Consult View to learn about processing.

Please help improve this documentation. If a section is hard to understand, there is a typo, you would like a new section added, or you detect any other improvement that can be made then please email support@vvi.com with your information.




© Copyright 1993-2011 by VVimaging, Inc. (VVI); All Rights Reserved. Please email support@vvi.com with any comments you have concerning this documentation. See Legal for trademark and legal information.