GL Studio C++ Runtime API
util.h File Reference

Generally useful defines, macros, enumerations and function prototypes. More...

#include "disti_assert.h"
#include "dynamic_array.h"
#include "gls_cpp_lang_support.h"
#include "gls_include.h"
#include "gls_matrix_affine.h"
#include "scoped_ptr.h"
#include "unhide_globals.h"
#include "vertex.h"
#include <algorithm>
#include <cmath>
#include <iostream>
#include <sstream>
#include <string>
#include <typeinfo>
#include <vector>
#include <unistd.h>
#include <cstdio>

Go to the source code of this file.

Classes

class  OpenGLMatrices
 Class to contain current OpenGL view, projection and draw matrices. More...
 
struct  InlinePixmap
 
class  glsCommandLine
 
class  InterfaceDescriptionClass
 
class  GlsMultiValBase
 
class  GlsMultiVal< T1, T2, T3, T4, T5, T6, T7, T8, T9, T10 >
 
class  GlsPropString
 
class  GlsPropStringQuoted
 
class  GlsGlobals
 Hold global objects so we can control order of destruction. More...
 

Namespaces

 disti
 

Macros

#define MIN(A, B)   ( ( A ) < ( B ) ? ( A ) : ( B ) )
 
#define MAX(A, B)   ( ( A ) > ( B ) ? ( A ) : ( B ) )
 

Enumerations

enum  GlsDefinedColorEnum
 

Functions

template<class X , class X1 , class X2 >
bool BETWEEN (const X &x, const X1 &x1, const X2 &x2)
 
template<class X >
bool IS_NEGATIVE (const X &x)
 
template<class X >
bool IS_POSITIVE (const X &x)
 
template<class X >
bool CloseToZero (const X x, const X threshold=X(1e-1))
 
template<class X >
bool VeryCloseToZero (X x)
 
template<class X >
bool IsNearZero (X x)
 
template<class X >
bool IS_ZERO (X x)
 
float OpenGLVersion ()
 
unsigned char * GlsDefinedColor (GlsDefinedColorEnum index)
 
void ChangeGlsDefinedColor (GlsDefinedColorEnum index, unsigned char red, unsigned char green, unsigned char blue, unsigned char alpha)
 
template<class T1 , class T2 >
bool Equal (T1 x, T2 y, float precision=0.001f)
 
template<class T >
const T & Min (const T &x, const T &y)
 
template<class T >
const T & Max (const T &x, const T &y)
 
template<class T , class Pred >
const T & Min (const T &x, const T &y, Pred pr)
 
template<class T , class Pred >
const T & Max (const T &x, const T &y, Pred pr)
 
template<class T >
GlsMatrixAffine< T > FindCoordinateTransformation (const Vector &new_origin, const Vector &new_i, const Vector &new_j, const Vector &new_k)
 
bool GetObjectCoordinatesTransformSameView (DisplayObject *from, DisplayObject *to, GlsMatrixType *outTransform)
 
DisplayFrame * GetTopLevelDisplayFrame (DisplayFrame *frame)
 
bool GetObjectCoordinatesTransform (DisplayObject *from, DisplayObject *to, GlsMatrixType *outTransform)
 
bool NotColinear (const Vector &a, const Vector &b, const Vector &c)
 
bool FindNonColinearVertices (int arraySize, Vector array[], int &index1, int &index2, int &index3, bool isVectorArray=true)
 
bool FindNonColinearVertices (int arraySize, Vertex array[], int &index1, int &index2, int &index3)
 
bool CalculateTexPointsFromTexCoords (DisplayObject *object)
 
int EncodeString (char *dest, const char *src, const int dest_str_length)
 
std::string EncodeString (const std::string &src)
 
int EncodedStringMinLength ()
 
int C_EncodeString (char *dest, const char *src, const int dest_str_length)
 
std::string C_EncodeString (const std::string &src)
 
int DecodeString (char *dest, const char *src, const int dest_str_length)
 
std::string DecodeString (const std::string &src)
 
int range_check (int num, double val,...)
 
int Safe_fopen (const char *filename, char *flags, FILE **f)
 
int Safe_fopen (const char *filename, char *flags, std::fstream &outstr)
 
void PushResourcePath (const char *resourcePath)
 
void PopResourcePath ()
 
void PushResourceFinder (std::string(*finder)(const std::string &))
 
std::string ResolvePath (const char *path)
 
FILE * gls_fopen (const char *filename, const char *flags)
 
std::string ResolveRuntimeResourcePath (const char *fileName)
 
bool FileExists (const char *filename)
 
bool IsDirectory (const char *filename)
 
std::string FileExtension (const std::string &filepath)
 
std::string FileName (const std::string &filepath)
 
std::string FilePath (const std::string &filepath)
 
const char * GetFilePath (const char *name)
 
char * GetFileName (const char *name)
 
void AppendTrailingSlash (char *s)
 
void AppendTrailingSlash (std::string &s)
 
char * PathToOS (const char *path)
 
std::string GetExtension (const std::string &filename)
 
const char * GetBaseName (const char *path)
 
char * GetBaseName (char *path)
 
void RemoveDoubleSlashes (char *path, char slash= '/')
 
void RemoveSpaces (std::string &entry)
 
float AngularDistanceDeg (float angle1, float angle2)
 
float AngularDistanceRad (float angle1, float angle2)
 
bool GetComponentClassNames (const char *dllFileName, DynamicArray< std::string > &nameList, const char *createClassTag="CreateComponent_")
 
std::string GetDefaultComponentClassName (const char *dllFileName)
 
std::string GetQualifiedInstanceName (const DisplayFrame *topFrame, const DisplayObject *obj)
 
std::string Uppercase (const std::string &str)
 
bool CheckDistiLicense (const char *licenseGroupName, const char *feature, const char *version, bool quiet)
 
void GlsGetOrtho (GlsMatrixType &m, double left, double right, double bottom, double top, double zNear, double zFar)
 
void GlsGetPerspective (GlsMatrixType &m, double fovy, double aspect, double zNear, double zFar)
 
template<class T >
Clamp (const T &val, const T &min, const T &max)
 
void Split (const std::string &s, const char delim, std::vector< std::string > &elems, const std::size_t maxElems=0)
 
std::vector< std::string > Split (const std::string &s, const char delim, const std::size_t maxElems=0)
 
std::string MakeString (const char *const cStr)
 Passing null to std::string is not well-defined. Create a string safely.
 

Variables

const int INLINE_TEXTURE_LINE_LENGTH = 240
 
unsigned char glsDefinedColors [GLS_COLOR_MAX][4]
 

Detailed Description

Generally useful defines, macros, enumerations and function prototypes.

Copyright Information

Copyright (c) 2017 by The DiSTI Corporation.
11301 Corporate Blvd; Suite 100
Orlando, Florida 32817
USA

All rights reserved.

This Software contains proprietary trade secrets of DiSTI and may not be reproduced, in whole or part, in any form, or by any means of electronic, mechanical, or otherwise, without the written permission of DiSTI. Said permission may be derived through the purchase of applicable DiSTI product licenses which detail the distribution rights of this content and any Derivative Works based on this or other copyrighted DiSTI Software.

NO WARRANTY. THE SOFTWARE IS PROVIDED "AS-IS," WITHOUT WARRANTY OF ANY KIND, AND ANY USE OF THIS SOFTWARE PRODUCT IS AT YOUR OWN RISK. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, DISTI AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES AND CONDITIONS, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE, TITLE, AND NON-INFRINGEMENT, WITH REGARD TO THE SOFTWARE.

LIMITATION OF LIABILITY. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, IN NO EVENT SHALL DISTI OR ITS SUPPLIERS BE LIABLE FOR ANY SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR INABILITY TO USE THE SOFTWARE, EVEN IF DISTI HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. DISTI'S ENTIRE LIABILITY AND YOUR EXCLUSIVE REMEDY SHALL NOT EXCEED FIVE DOLLARS (US$5.00).

The aforementioned terms and restrictions are governed by the laws of the State of Florida and the United States of America.

Macro Definition Documentation

#define MAX (   A,
 
)    ( ( A ) > ( B ) ? ( A ) : ( B ) )

Determines which argument is larger

Deprecated:
Use disti::Min() instead.
#define MIN (   A,
 
)    ( ( A ) < ( B ) ? ( A ) : ( B ) )

Determines which argument is smaller

Deprecated:
Use disti::Min() instead.