Cobalt Framework  beta
Console application support
CBError.h
Go to the documentation of this file.
00001 
00008 #ifndef CBERROR_H
00009 #define CBERROR_H
00010 
00011 #include <Coconut/Coconut.h>
00012 
00016 typedef enum {
00018     CBNoError                       = 0,
00019     CBNoDefaultCommand,
00020     CBInvalidLongOptionName,
00021     CBInvalidShortOptionName,
00022     CBNoParameterForLongOptionName,
00023     CBNoParameterForShortOptionName
00024 } CBErrorType ;
00025 
00029 struct CBError {
00031     CBErrorType             errorType ;
00033     union {
00034         const char *        invalidLongName ;
00035         char                invalidShortName ;
00036         const char *        noParameterLongName ;
00037         char                noParameterShortName ;
00038     } info ;
00039 } ;
00040 
00045 static inline void
00046 CBSetNoDefaultCommandError(struct CBError * dst)
00047 {
00048     dst->errorType = CBNoDefaultCommand ;
00049 }
00050 
00056 static inline void
00057 CBSetInvalidLongNameOption(struct CBError * dst, const char * optname)
00058 {
00059     dst->errorType = CBInvalidLongOptionName ;
00060     (dst->info).invalidLongName = optname ;
00061 }
00062 
00068 static inline void
00069 CBSetInvalidShortNameOption(struct CBError * dst, char optchar)
00070 {
00071     dst->errorType = CBInvalidShortOptionName ;
00072     (dst->info).invalidShortName = optchar ;
00073 }
00074 
00080 static inline void
00081 CBSetNoParameterForLongNameOption(struct CBError * dst, const char * optname)
00082 {
00083     dst->errorType = CBNoParameterForLongOptionName ;
00084     (dst->info).noParameterLongName = optname ;
00085 }
00086 
00092 static inline void
00093 CBSetNoParameterForShortNameOption(struct CBError * dst, char optchar)
00094 {
00095     dst->errorType = CBNoParameterForShortOptionName ;
00096     (dst->info).noParameterShortName = optchar ;
00097 }
00098 
00106 struct CNString *
00107 CBErrorToString(const struct CBError * src, struct CNResource * resource) ;
00108 
00109 #endif  /* CBERROR_H */
 All Classes Files Functions Variables Enumerations Enumerator Defines