HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
UT_Access.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: UT_Access.h (UT Library, C++)
7  *
8  * COMMENTS: Provides cross-platform version of access(), UTaccess().
9  */
10 
11 #ifndef __UT_ACCESS_H_INCLUDED__
12 #define __UT_ACCESS_H_INCLUDED__
13 
14 #include "UT_API.h"
15 
16 #ifdef _WIN32
17 
18 //
19 // Windows
20 //
21 
22 #include <iosfwd>
23 
24 #define F_OK 0
25 #define X_OK 1
26 #define W_OK 2
27 #define R_OK 4
28 
29 /// Platform-independent wrapper for the POSIX access() function. Returns 0 if
30 /// we have the requested permissions.
31 UT_API int UTaccess(const char *path, int mode);
32 
33 /// Method for debugging UTaccess() problems with verbose into set to out.
34 UT_API int UTaccessDebug(const char *path, int mode, std::ostream &out);
35 
36 #else
37 
38 //
39 // Non-Windows
40 //
41 
42 #include <unistd.h>
43 
44 /// Platform-independent wrapper for the POSIX access() function. Returns 0 if
45 /// we have the requested permissions.
46 static inline int
47 UTaccess(const char *path, int mode)
48 {
49  return access(path, mode);
50 }
51 
52 #endif // _WIN32
53 
54 /// Sets the timeout for how old UTaccess() cached results are deemed valid.
55 UT_API int UTaccessSetCacheExpiry(int num_seconds);
56 
57 /// Temporarily disable use of the UTaccess() cache.
58 /// This currently only has an effect on Windows for testing W_OK of network
59 /// paths.
61 {
62 public:
64  : myOldExpiry(UTaccessSetCacheExpiry(0))
65  {
66  }
67 
69  {
70  (void) UTaccessSetCacheExpiry(myOldExpiry);
71  }
72 
73 private:
74  int myOldExpiry;
75 };
76 
77 #endif // __UT_ACCESS_H_INCLUDED__
UT_API int UTaccessSetCacheExpiry(int num_seconds)
Sets the timeout for how old UTaccess() cached results are deemed valid.
typedef void(APIENTRYP PFNGLCULLFACEPROC)(GLenum mode)
GLsizei const GLchar *const * path
Definition: glcorearb.h:3340
#define UT_API
Definition: UT_API.h:12
GLuint GLint GLboolean GLint GLenum access
Definition: glcorearb.h:2221
GLenum mode
Definition: glcorearb.h:98