aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXavi Artigas <xavierartigas@yahoo.es>2019-01-15 04:34:41 -0800
committerapache <apache@e5-web1.enlightenment.org>2019-01-15 04:34:41 -0800
commit734b708ad07b963a971d93c9f883fcfedba26d76 (patch)
tree3e08802f64386538098164c6c469803874b84810
parentdownload_latest: use correct evisum versioning. (diff)
downloadwww-content-734b708ad07b963a971d93c9f883fcfedba26d76.tar.gz
Wiki page generic-value.md changed with summary [Update to latest syntax] by Xavi Artigas
-rw-r--r--pages/develop/guides/csharp/eina/generic-value.md.txt102
1 files changed, 51 insertions, 51 deletions
diff --git a/pages/develop/guides/csharp/eina/generic-value.md.txt b/pages/develop/guides/csharp/eina/generic-value.md.txt
index fe8968755..969d1d5fa 100644
--- a/pages/develop/guides/csharp/eina/generic-value.md.txt
+++ b/pages/develop/guides/csharp/eina/generic-value.md.txt
@@ -4,11 +4,11 @@
# Eina Generic Values in C# #
-The `eina` namespace provides data types and useful tools which are not available in plain C. The C# runtime though, already provides most of `eina`'s functionality so you will rarely need to use it. The `Eina Programming Guides` are still useful for those EFL methods which use `eina` types as parameters or return types.
+The `Eina` namespace provides data types and useful tools which are not available in plain C. The C# runtime though, already provides most of `Eina`'s functionality so you will rarely need to use it. The `Eina Programming Guides` are still useful for those EFL methods which use `Eina` types as parameters or return types.
-The `eina.Value` class provides storage of and access to generic data, allowing you to store whatever you want in a single `eina.Value` type. It is meant for simple data types, providing uniform access and release functions for the exchange of data while preserving their types. `eina.Value` supports a number of predefined types, can be extended with additional user-provided types and can convert between differing data types including strings.
+The `Eina.Value` class provides storage of and access to generic data, allowing you to store whatever you want in a single `Eina.Value` type. It is meant for simple data types, providing uniform access and release functions for the exchange of data while preserving their types. `Eina.Value` supports a number of predefined types, can be extended with additional user-provided types and can convert between differing data types including strings.
-Examples of `eina.Value` usage can be found in the [EFL examples git repository](https://git.enlightenment.org/tools/examples.git/) in the file [`reference/csharp/eina/src/eina_value.cs`](https://git.enlightenment.org/tools/examples.git/tree/reference/csharp/eina/src/eina_value.cs).
+Examples of `Eina.Value` usage can be found in the [EFL examples git repository](https://git.enlightenment.org/tools/examples.git/) in the file [`reference/csharp/eina/src/eina_value.cs`](https://git.enlightenment.org/tools/examples.git/tree/reference/csharp/eina/src/eina_value.cs).
| | WARNING | |
| --- | ------- | --- |
@@ -16,9 +16,9 @@ Examples of `eina.Value` usage can be found in the [EFL examples git repository]
## Value Types ##
-`eina.Value` can handle the following common *simple* types (found inside the `eina.ValueType` enum):
+`Eina.Value` can handle the following common *simple* types (found inside the `Eina.ValueType` enum):
-| `eina.ValueType` | C# type | Content |
+| `Eina.ValueType` | C# type | Content |
| ------------------- | -------------- | ---------------------------------------- |
| `SByte` | `sbyte` | Signed char (8-bit integer) |
| `Byte` | `byte` | Unsigned char (8-bit integer) |
@@ -32,44 +32,44 @@ Examples of `eina.Value` usage can be found in the [EFL examples git repository]
| `Double` | `double` | Double precision (64-bit) floating point |
| `String` | `string` | Unicode text string |
-In addition, `eina.Value` supports the following *aggregate* types:
+In addition, `Eina.Value` supports the following *aggregate* types:
-| `eina.ValueType` | Content |
-| ---------------- | --------------------------------------------------- |
-| `Array` | Manages arrays of elements using `Eina_Value_Array` |
-| `List` | Manages lists of elements using `Eina_Value_List` |
-| `Hash` | Manages hash tables using `Eina_Value_Hash` |
+| `Eina.ValueType` | Content |
+| ---------------- | -------------------------- |
+| `Array` | Manages arrays of elements |
+| `List` | Manages lists of elements |
+| `Hash` | Manages hash tables |
## Simple Values ##
### Creating Simple Values ###
-New values can be allocated with the standard `new()` operator passing in the desired type as an `eina.ValueType`:
+New values can be allocated with the standard `new()` operator passing in the desired type as an `Eina.ValueType`:
```csharp
-var int_val = new eina.Value(eina.ValueType.Int32);
+var int_val = new Eina.Value(Eina.ValueType.Int32);
```
-When the `int_val` variable goes out of scope any memory allocated internally by the `eina.Value` will be freed as expected.
+When the `int_val` variable goes out of scope any memory allocated internally by the `Eina.Value` will be freed as expected.
### Changing the Type of Simple Values ###
-The type of an `eina.Value` can be changed at any time using `Setup()` and passing in the desired new type:
+The type of an `Eina.Value` can be changed at any time using `Setup()` and passing in the desired new type:
```csharp
-var val = new eina.Value(eina.ValueType.Int32);
-val.Setup(eina.ValueType.Float);
+var val = new Eina.Value(Eina.ValueType.Int32);
+val.Setup(Eina.ValueType.Float);
```
-The content of the `eina.Value` will be destroyed, but **not** the `eina.Value` variable.
+The content of the `Eina.Value` will be destroyed, but **not** the `Eina.Value` variable.
### Accessing the Content of Simple Values ###
-The contents of a simple `eina.Value` can be set with `Set()` and retrieved with `Get()`. Note that the types provided must match the type used when creating the `eina.Value`.
+The contents of a simple `Eina.Value` can be set with `Set()` and retrieved with `Get()`. Note that the types provided must match the type used when creating the `Eina.Value`.
For instance, for integers:
```csharp
-var val = new eina.Value(eina.ValueType.Int32);
+var val = new Eina.Value(Eina.ValueType.Int32);
val.Set(123);
int i;
@@ -78,7 +78,7 @@ val.Get(out i);
Strings are also easily handled:
```csharp
-var val = new eina.Value(eina.ValueType.String);
+var val = new Eina.Value(Eina.ValueType.String);
val.Set("My string");
string str;
@@ -87,33 +87,33 @@ val.Get(out str);
### Copying the Content of a Value ###
-`eina.Value`s are **referenced types**, which means that when you make a copy of an `eina.Value` variable, the underlying value is not copied: both variables point to the same value.
+`Eina.Value`s are **referenced types**, which means that when you make a copy of an `Eina.Value` variable, the underlying value is not copied: both variables point to the same value.
```csharp
-var src = new eina.Value(eina.ValueType.Int32);
+var src = new Eina.Value(Eina.ValueType.Int32);
src.Set(100);
var dst = src;
src.Set(200);
// Now both src and dst contain the integer 200
```
-If you need to create a separate `eina.Value` variable containing the same value, use `new` and initialize it:
+If you need to create a separate `Eina.Value` variable containing the same value, use `new` and initialize it:
```csharp
-var src = new eina.Value(eina.ValueType.Int32);
+var src = new Eina.Value(Eina.ValueType.Int32);
src.Set(100);
-var dst = new eina.Value(src);
+var dst = new Eina.Value(src);
src.Set(200);
// Now src=200 and dst=100
```
### Comparing Two Values ###
-Two `eina.Value`s of the same type can be compared with the standard operators `<`, `==`, `!=` and `>`. The exact meaning of the comparison depends on the value type.
+Two `Eina.Value`s of the same type can be compared with the standard operators `<`, `==`, `!=` and `>`. The exact meaning of the comparison depends on the value type.
```csharp
-var v1 = new eina. Value(eina.ValueType.Float);
-var v2 = new eina. Value(eina.ValueType.Float);
+var v1 = new Eina. Value(Eina.ValueType.Float);
+var v2 = new Eina. Value(Eina.ValueType.Float);
v1.Set(7.0f);
v2.Set(7.5f);
if (v1 > v2) { ... }
@@ -123,11 +123,11 @@ The internal method `v1.Compare(v2)` is also available. The exact meaning of the
### Converting Between Values ###
-Most `eina.Value`s allow conversion from one type to another using the `ConvertTo()` function. The result of the conversion depends on the types in use. This function returns `true` if the conversion is successful. The conversion is typically very strict, meaning that conversion of negative values into unsigned types will fail and values which will not fit in the target type - i.e. conversions that would result in an overflow - will also fail.
+Most `Eina.Value`s allow conversion from one type to another using the `ConvertTo()` function. The result of the conversion depends on the types in use. This function returns `true` if the conversion is successful. The conversion is typically very strict, meaning that conversion of negative values into unsigned types will fail and values which will not fit in the target type - i.e. conversions that would result in an overflow - will also fail.
```csharp
-var v1 = new eina.Value(eina.ValueType.Int);
-var v2 = new eina.Value(eina.ValueType.Float);
+var v1 = new Eina.Value(Eina.ValueType.Int);
+var v2 = new Eina.Value(Eina.ValueType.Float);
v1.Set(7);
v1.ConvertTo(v2);
Console.WriteLine(v2);
@@ -137,32 +137,32 @@ The above code should output `7.0000` on the screen because `v2` is a floating t
### Converting to Strings ###
-All `eina.Value`s allow for conversion into a string, and, for convenience, there is a dedicated conversion method: `ToString()`.
+All `Eina.Value`s allow for conversion into a string, and, for convenience, there is a dedicated conversion method: `ToString()`.
```csharp
-var v1 = new eina.Value(eina.ValueType.Int);
+var v1 = new Eina.Value(Eina.ValueType.Int);
v1.Set(7);
string str = v1.ToString();
```
### Implicit Conversions ###
-For convenience, implicit conversion operators also exist between an `eina.Value` and the actual stored type, so operations like these are possible:
+For convenience, implicit conversion operators also exist between an `Eina.Value` and the actual stored type, so operations like these are possible:
```csharp
-eina.Value int_val = 123;
-eina.Value str_val = "My string";
+Eina.Value int_val = 123;
+Eina.Value str_val = "My string";
int i = int_val;
string str = str_val;
```
-These conversions allow directly providing native values to EFL methods expecting an `eina.Value`, for example.
+These conversions allow directly providing native values to EFL methods expecting an `Eina.Value`, for example.
> **NOTE:**
> As with all implicit conversions, use with caution to make sure the compiler is actually choosing the types you expect.
## Aggregate Values ##
-`eina.Value` supports handling collections of simple values through the aggregate types `eina.ValueType.Array`, `eina.ValueType.List` and `eina.ValueType.Hash`.
+`Eina.Value` supports handling collections of simple values through the aggregate types `Eina.ValueType.Array`, `Eina.ValueType.List` and `Eina.ValueType.Hash`.
All aggregate types allow the operations for simple types described above as well as some specific methods, typically involving construction and access to particular elements within the collection.
@@ -170,10 +170,10 @@ All aggregate types allow the operations for simple types described above as wel
An array is a contiguous block of memory which holds a collection of elements of the same type. Accessing and appending new elements at the end is typically very fast, but removing elements from the beginning or the middle is not.
-**Create** a new array with `new(eina.ValueType.Array, subtype, step)`, or re-configure an existing one with `Setup(eina.ValueType.Array, subtype, step)`. The `subtype` parameter is the type of the `eina.Value`s that will be stored in the array. The `step` parameter indicates how many elements are added to the end of the array every time it needs to be expanded, since it is typically more efficient to enlarge the array by chunks rather than element by element. Its default value is 0 meaning that EFL will choose a value for you.
+**Create** a new array with `new(Eina.ValueType.Array, subtype, step)`, or re-configure an existing one with `Setup(Eina.ValueType.Array, subtype, step)`. The `subtype` parameter is the type of the `Eina.Value`s that will be stored in the array. The `step` parameter indicates how many elements are added to the end of the array every time it needs to be expanded, since it is typically more efficient to enlarge the array by chunks rather than element by element. Its default value is 0 meaning that EFL will choose a value for you.
```csharp
-var varray = new eina.Value(eina.ValueType.Array, eina.ValueType.Int32);
+var varray = new Eina.Value(Eina.ValueType.Array, Eina.ValueType.Int32);
```
**Retrieve the number of elements** in an array with `Count()`.
@@ -199,7 +199,7 @@ int old_val = varray[1];
**Retrieve the type of the elements** of an array (the `subtype`) with `GetValueSubType()`:
```csharp
-eina.ValueType subtype = varray.GetValueSubType();
+Eina.ValueType subtype = varray.GetValueSubType();
```
> **NOTE:**
@@ -207,12 +207,12 @@ eina.ValueType subtype = varray.GetValueSubType();
### Lists ###
-A list is a linked collection of `eina.Value`s in which each element contains a pointer to the next element. Insertions and deletions anywhere in the list are typically very fast, but accessing a given position can be slow since it requires traveling through the list.
+A list is a linked collection of `Eina.Value`s in which each element contains a pointer to the next element. Insertions and deletions anywhere in the list are typically very fast, but accessing a given position can be slow since it requires traveling through the list.
-**Create** a new list with `new(eina.ValueType.Array, subtype)`, or configure an existing one with `Setup(subtype)`. The `subtype` parameter is the type of the `eina.Value`s that will be stored in the list.
+**Create** a new list with `new(Eina.ValueType.Array, subtype)`, or configure an existing one with `Setup(subtype)`. The `subtype` parameter is the type of the `Eina.Value`s that will be stored in the list.
```csharp
-var vlist = new eina.Value(eina.ValueType.List, eina.ValueType.Int32);
+var vlist = new Eina.Value(Eina.ValueType.List, Eina.ValueType.Int32);
```
**Retrieve the number of elements** in a list with `Count()`.
@@ -241,7 +241,7 @@ int old_val = vlist[1];
**Retrieve the type of the elements** of a list (the `subtype`) with `GetValueSubType()`:
```csharp
-eina.ValueType subtype = vlist.GetValueSubType();
+Eina.ValueType subtype = vlist.GetValueSubType();
```
> **NOTE:**
@@ -249,15 +249,15 @@ eina.ValueType subtype = vlist.GetValueSubType();
### Hash Tables ###
-A hash table stores `einva.Value`s indexed by a string key rather than an integer. Insertions, deletions and searches are typically very fast, at the cost of increased memory consumption.
+A hash table stores `Eina.Value`s indexed by a string key rather than an integer. Insertions, deletions and searches are typically very fast, at the cost of increased memory consumption.
> **NOTE:**
-> Implementation of Hash tables inside `eina.Value`s is not complete at this moment.
+> Implementation of Hash tables inside `Eina.Value`s is not complete at this moment.
-**Create** a new hash table with `new(eina.ValueTYpe.Hash, subtype, bucket_size)`, or configure an existing one with `Setup(subtype, bucket_size)`. The `subtype` parameter is the type of the `eina.Value`s that will be stored in the hash table. The `bucket_size` parameter indicates how the table is to be expanded as new elements are added; use 0 and a sane default will be chosen automatically.
+**Create** a new hash table with `new(Eina.ValueType.Hash, subtype, bucket_size)`, or configure an existing one with `Setup(subtype, bucket_size)`. The `subtype` parameter is the type of the `Eina.Value`s that will be stored in the hash table. The `bucket_size` parameter indicates how the table is to be expanded as new elements are added; use 0 and a sane default will be chosen automatically.
```csharp
-var vhash = new (eina.ValueType.Hash, eina.ValueType.Int32);
+var vhash = new (Eina.ValueType.Hash, Eina.ValueType.Int32);
```
**Retrieve the number of elements** in a hash table with `Count()`.
@@ -269,7 +269,7 @@ int count = vhash.Count();
## Further Reading ##
[Eina Value example](https://git.enlightenment.org/tools/examples.git/tree/reference/csharp/eina/src/eina_value.cs)
-: Miscellaneous usage example for the `eina.Value` type.
+: Miscellaneous usage example for the `Eina.Value` type.
[Generic Value API](/develop/legacy/api/c/start#group__Eina__Value__Group.html)
: Reference Guide for the Generic Value API (in C).