- Main Page
- Classes
- Files
- Directories

- File List
- File Members

Functions

# fbxcolladaiostream.h File Reference

`#include <fbxsdk.h>`
`#include <fbxsdk/fbxsdk_nsbegin.h>`
`#include <fbxsdk/fbxsdk_nsend.h>`

Go to the source code of this file.

## Functions
template<typename TYPE >
int | FromStringToArray (const char *pString, TYPE *pArray, int pSourceUnitOffset, int pSourceValidUnitCount, int pSourceGroupSize, int pDestUnitOffset, int pDestValidUnitCount, int pDestGroupSize, TYPE pDefaultValue=TYPE())
| Parse the string into an array.
template<typename T >
bool | FromString (T *pDest, const char *pSourceBegin, const char **pSourceEnd=NULL)
| Convert part of the source string into destination type.
template<>
bool | FromString (int *pDest, const char *pSourceBegin, const char **pSourceEnd)
template<>
bool | FromString (double *pDest, const char *pSourceBegin, const char **pSourceEnd)
template<>
bool | FromString (FbxString *pDest, const char *pSourceBegin, const char **pSourceEnd)
template<>
bool | FromString (FbxDouble2 *pDest, const char *pSourceBegin, const char **pSourceEnd)
template<>
bool | FromString (FbxDouble3 *pDest, const char *pSourceBegin, const char **pSourceEnd)
template<>
bool | FromString (FbxDouble4 *pDest, const char *pSourceBegin, const char **pSourceEnd)
template<>
bool | FromString (FbxVector4 *pDest, const char *pSourceBegin, const char **pSourceEnd)
template<>
bool | FromString (FbxAMatrix *pDest, const char *pSourceBegin, const char **pSourceEnd)
template<typename T >
const FbxString | ToString (const T &pValue)
template<>
const FbxString | ToString (const FbxVector4 &pValue)
template<>
const FbxString | ToString (const FbxAMatrix &pValue)
const FbxString | DecodePercentEncoding (const FbxString &pEncodedString)
| Decode percent encoded characters, returns an empty string if there's an error.

## Detailed Description

Definition in file fbxcolladaiostream.h.

## Function Documentation

int FromStringToArray | ( | const char * | pString,
|  | TYPE * | pArray,
|  | int | pSourceUnitOffset,
|  | int | pSourceValidUnitCount,
|  | int | pSourceGroupSize,
|  | int | pDestUnitOffset,
|  | int | pDestValidUnitCount,
|  | int | pDestGroupSize,
|  | TYPE | pDefaultValue = `TYPE()`
| ) |  |

Search for all occurrences

Parse the string into an array.

The source string is made up with many groups and each group contains pSourceGroupSize units separated by spaces; The destination array is also made up with many groups and each unit contains pDestGroupSize units. The valid unit range in each source group is [pSourceUnitOffset, pSourceUnitOffset + pSourceValidUnitCount). The valid unit range in each destination unit is [pDestUnitOffset, pDestUnitOffset + pDestValidUnitCount). The units in invalid range of destination is set to a default value.

Definition at line 27 of file fbxcolladaiostream.h.

    {
        if (pString == 0 || pArray == 0)
            return 0;

        FBX_ASSERT(pSourceUnitOffset >= 0 && pSourceUnitOffset < pSourceGroupSize);
        FBX_ASSERT(pSourceValidUnitCount >= 0 && pSourceUnitOffset + pSourceValidUnitCount <= pSourceGroupSize);
        FBX_ASSERT(pDestUnitOffset >= 0 && pDestUnitOffset < pDestGroupSize);
        FBX_ASSERT(pDestValidUnitCount >= 0 && pDestUnitOffset + pDestValidUnitCount <= pDestGroupSize);
        const char * lSource = pString;
        TYPE * lDest = pArray;

        int lReadCount = 0;
        int lSourceCounter = 0;
        int lDestCounter = 0;
        const int lSourceUnitValidEnd = pSourceUnitOffset + pSourceValidUnitCount;
        const int lDestUnitGap = pDestGroupSize - pDestValidUnitCount - pDestUnitOffset;
        while (lSource && *lSource)
        {
            TYPE lData;
            const char * lSourceStart = lSource;
            if (FromString(&lData, lSource, &lSource) && lSourceCounter >= pSourceUnitOffset && lSourceCounter < lSourceUnitValidEnd)
            {
                if (lDestCounter == 0)
                {
                    for (int lIndex = 0; lIndex < pDestUnitOffset; ++lIndex)
                        *(lDest++) = pDefaultValue;
                }

                *lDest++ = lData;
                ++lReadCount;
                ++lDestCounter;
                if (lDestCounter == pDestValidUnitCount)
                {
                    lDestCounter = 0;
                    for (int lIndex = 0; lIndex < lDestUnitGap; ++lIndex)
                        *lDest++ = pDefaultValue;
                }
            }
            else
            {
                // we met a stop condition of FromString. In the normal case, lSource should now be "" or ' '. If not,
                // the converted string is corrupted and we have to break the loop. We can detect this by checking
                // if lSource pointer has moved.
                if (lSource == lSourceStart)
                {
                    break;
                }
            }
            ++lSourceCounter;
            if (lSourceCounter == pSourceGroupSize)
                lSourceCounter = 0;
        }
        return lReadCount;
    }

bool FromString | ( | T * | pDest,
|  | const char * | pSourceBegin,
|  | const char ** | pSourceEnd = `NULL`
| ) |  |

Search for all occurrences

Convert part of the source string into destination type.

Parameters:

  pDest | The destination with a specific type.
  pSourceBegin | The begin of the source string.
  pSourceEnd | Return the end of the part of the source string.

Returns:
  Return `true` on success and `false` if else.

bool FromString | ( | int * | pDest,
|  | const char * | pSourceBegin,
|  | const char ** | pSourceEnd
| ) |  |

Search for all occurrences

bool FromString | ( | double * | pDest,
|  | const char * | pSourceBegin,
|  | const char ** | pSourceEnd
| ) |  |

Search for all occurrences

bool FromString | ( | FbxString * | pDest,
|  | const char * | pSourceBegin,
|  | const char ** | pSourceEnd
| ) |  |

Search for all occurrences

bool FromString | ( | FbxDouble2 * | pDest,
|  | const char * | pSourceBegin,
|  | const char ** | pSourceEnd
| ) |  |

Search for all occurrences

bool FromString | ( | FbxDouble3 * | pDest,
|  | const char * | pSourceBegin,
|  | const char ** | pSourceEnd
| ) |  |

Search for all occurrences

bool FromString | ( | FbxDouble4 * | pDest,
|  | const char * | pSourceBegin,
|  | const char ** | pSourceEnd
| ) |  |

Search for all occurrences

bool FromString | ( | FbxVector4 * | pDest,
|  | const char * | pSourceBegin,
|  | const char ** | pSourceEnd
| ) |  |

Search for all occurrences

bool FromString | ( | FbxAMatrix * | pDest,
|  | const char * | pSourceBegin,
|  | const char ** | pSourceEnd
| ) |  |

Search for all occurrences

const FbxString ToString | ( | const T & | pValue | ) |

Search for all occurrences

Definition at line 105 of file fbxcolladaiostream.h.

    {
        return FbxString(pValue);
    }

const FbxString ToString | ( | const FbxVector4 & | pValue | ) |

Search for all occurrences

const FbxString ToString | ( | const FbxAMatrix & | pValue | ) |

Search for all occurrences

const FbxString DecodePercentEncoding | ( | const FbxString & | pEncodedString | ) |

Search for all occurrences

Decode percent encoded characters, returns an empty string if there's an error.

For example, a string like "abc%20abc" is converted into "abc abc".

Parameters:

  pEncodedString | The percent encoded string.

Returns:
  The decoded string.