Mobile SDK for Windows Apps2.0
Transforming Windows apps into Mobile apps
cmpresult.h
Go to the documentation of this file.
00001 
00011 #pragma once
00012 
00013 #include <cmptypes.h>
00014 
00022 #define STATUS_CODE(Component, Status) (((Component)<<16) | (Status))
00023 
00024 // status check macros
00025 // if the last word is 0, then there is no error
00026 
00027 
00035 #define CMP_SUCCESS(code) (((code) & 0xFFFF) == 0)
00036 
00044 #define CMP_FAILURE(code) (!CMP_SUCCESS(code))
00045 
00051 #define CMP_COMPONENT_CODE(status) ((status) >>16)
00052 
00053 #define SET_CMPRESULT(prc, rc) if(prc) *prc = rc
00054 
00055 #ifdef __cplusplus
00056 
00057 // only support checking an array of CMPRESULT in C++
00058 
00059 inline static bool CMPSuccessArray(CMPRESULT* codearray, int size)
00060 {
00061     bool success=true; 
00062     
00063     for(int i=0; i < size; i++)
00064     {
00065         if(CMP_FAILURE(codearray[i]))
00066         {
00067             success = false;
00068             break;
00069         }
00070     }
00071 
00072     return(success);
00073 }
00074 
00075 #define CMP_SUCCESS_ARRAY(codearray, size) CMPSuccessArray(codearray, size)
00076 
00077 #endif
00078 
00079 // actual status codes are defined in cmpenum.h
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Events Defines