GRU - Generic Reusable Utilities
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
Functions
gru_status.c File Reference
#include "gru_status.h"

Functions

gru_export gru_status_t gru_status_new ()
 Copyright 2016 Otavio Rodolfo Piske. More...
 
void gru_status_set (gru_status_t *status, gru_status_code_t code, const char *message,...)
 Sets the status. More...
 
void gru_status_reset (gru_status_t *status)
 Resets the status. More...
 
void gru_status_set_success (gru_status_t *status)
 Sets the status to success. More...
 
void gru_status_strerror (gru_status_t *status, gru_status_code_t code, int errnum)
 Sets the status from the errno. More...
 
bool gru_status_error (const gru_status_t *status)
 Checks for error status. More...
 
bool gru_status_success (const gru_status_t *status)
 Checks for success status. More...
 

Function Documentation

bool gru_status_error ( const gru_status_t status)
inline

Checks for error status.

Parameters
statusthe status object to check
Returns
true if an error or false otherwise
Examples:
config/gru_config_test.c, network/gru_uri_test.c, network/gru_uri_test_opt.c, string/gru_split_test.c, and string/gru_split_test_2.c.
gru_export gru_status_t gru_status_new ( )
inline

Copyright 2016 Otavio Rodolfo Piske.

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.

Examples:
collection/gru_list_test.c, config/gru_config_test.c, network/gru_uri_format_test.c, network/gru_uri_test.c, network/gru_uri_test_opt.c, string/gru_serialize_test.c, string/gru_split_test.c, and string/gru_split_test_2.c.
void gru_status_reset ( gru_status_t status)

Resets the status.

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

Sets the status.

Parameters
statusan instance of the status object to set
codethe code to set the object to
messagethe status message followed by any other parameter as accepted by vasprintf
void gru_status_set_success ( gru_status_t status)

Sets the status to success.

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

Sets the status from the errno.

Parameters
statusan instance of the status object to set
codethe code to set the object to
errnumthe error number (as in errno)
bool gru_status_success ( const gru_status_t status)
inline

Checks for success status.

Parameters
statusthe status object to check
Returns
true if success or false otherwise