Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 10:25:22

0001 // Protocol Buffers - Google's data interchange format
0002 // Copyright 2023 Google LLC.  All rights reserved.
0003 //
0004 // Use of this source code is governed by a BSD-style
0005 // license that can be found in the LICENSE file or at
0006 // https://developers.google.com/open-source/licenses/bsd
0007 
0008 #ifndef UPB_BASE_STATUS_H_
0009 #define UPB_BASE_STATUS_H_
0010 
0011 #include <stdarg.h>
0012 
0013 // Must be last.
0014 #include "upb/port/def.inc"
0015 
0016 #define _kUpb_Status_MaxMessage 511
0017 
0018 typedef struct {
0019   bool ok;
0020   char msg[_kUpb_Status_MaxMessage];  // Error message; NULL-terminated.
0021 } upb_Status;
0022 
0023 #ifdef __cplusplus
0024 extern "C" {
0025 #endif
0026 
0027 UPB_API const char* upb_Status_ErrorMessage(const upb_Status* status);
0028 UPB_API bool upb_Status_IsOk(const upb_Status* status);
0029 
0030 // These are no-op if |status| is NULL.
0031 UPB_API void upb_Status_Clear(upb_Status* status);
0032 void upb_Status_SetErrorMessage(upb_Status* status, const char* msg);
0033 void upb_Status_SetErrorFormat(upb_Status* status, const char* fmt, ...)
0034     UPB_PRINTF(2, 3);
0035 void upb_Status_VSetErrorFormat(upb_Status* status, const char* fmt,
0036                                 va_list args) UPB_PRINTF(2, 0);
0037 void upb_Status_VAppendErrorFormat(upb_Status* status, const char* fmt,
0038                                    va_list args) UPB_PRINTF(2, 0);
0039 
0040 #ifdef __cplusplus
0041 } /* extern "C" */
0042 #endif
0043 
0044 #include "upb/port/undef.inc"
0045 
0046 #endif /* UPB_BASE_STATUS_H_ */