/builddir/build/BUILD/gru-0.1.0/src/common/gru_status.h File Reference

#include <assert.h>
#include <errno.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "common/gru_portable.h"

Go to the source code of this file.

Data Structures

struct  gru_status_t_
 Status type. More...

Defines

#define GRU_MAX_ERROR_MESSAGE   1024
 Copyright 2016 Otavio Rodolfo Piske.

Typedefs

typedef enum gru_status_code_t_ gru_status_code_t
typedef struct gru_status_t_ gru_status_t
 Status type.

Enumerations

enum  gru_status_code_t_ { GRU_SUCCESS, GRU_FAILURE }

Functions

gru_export gru_status_t gru_status_new ()
 Create a new status object.
gru_export void gru_status_set (gru_status_t *status, gru_status_code_t code, const char *message,...)
 Sets the status.
gru_export void gru_status_strerror (gru_status_t *status, gru_status_code_t code, int errnum)
 Sets the status from the errno.
gru_export void gru_status_reset (gru_status_t *status)
 Resets the status.
gru_export void gru_status_set_success (gru_status_t *status)
 Sets the status to success.
gru_export bool gru_status_error (const gru_status_t *status)
 Checks for error status.
gru_export bool gru_status_success (const gru_status_t *status)
 Checks for success status.

Define Documentation

#define GRU_MAX_ERROR_MESSAGE   1024

Copyright 2016 Otavio Rodolfo Piske.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.


Typedef Documentation

typedef struct gru_status_t_ gru_status_t

Status type.


Enumeration Type Documentation

Enumerator:
GRU_SUCCESS 
GRU_FAILURE 

Function Documentation

gru_export bool gru_status_error ( const gru_status_t status  )  [inline]

Checks for error status.

Parameters:
status the status object to check
Returns:
true if an error or false otherwise
gru_export gru_status_t gru_status_new (  )  [inline]

Create a new status object.

Returns:
a new status object

Create a new status object.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

gru_export void gru_status_reset ( gru_status_t status  ) 

Resets the status.

Parameters:
status an instance of the status object to set
gru_export void gru_status_set ( gru_status_t status,
gru_status_code_t  code,
const char *  message,
  ... 
)

Sets the status.

Parameters:
status an instance of the status object to set
code the code to set the object to
message the status message followed by any other parameter as accepted by vasprintf
gru_export void gru_status_set_success ( gru_status_t status  ) 

Sets the status to success.

Parameters:
status an instance of the status object to set
gru_export void gru_status_strerror ( gru_status_t status,
gru_status_code_t  code,
int  errnum 
)

Sets the status from the errno.

Parameters:
status an instance of the status object to set
code the code to set the object to
errnum the error number (as in errno)
gru_export bool gru_status_success ( const gru_status_t status  )  [inline]

Checks for success status.

Parameters:
status the status object to check
Returns:
true if success or false otherwise
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines

Generated on 10 Feb 2018 for GRU - Generic Reusable Utilities by  doxygen 1.6.1