MrSID Decode SDK for Raster Reference Manual  9.5.5.5244
ErrorHandling.cpp
//
// This code is property of Celartem, Inc dba Extensis.
// Copyright (c) 1995-2023. All rights reserved.
// Use permitted only under license from Extensis.
//
/* PUBLIC */
// This demonstrates how to handle errors and convert them into strings.
#include "main.h"
#include "support.h"
#include "lt_fileSpec.h"
LT_USE_NAMESPACE(LizardTech);
LT_STATUS ErrorHandling()
{
// initialize error string system (required for formatted strings)
TEST_SUCCESS(initializeStatusStrings());
// make the image reader: we will use an invalid file
const LTFileSpec fileSpec(INPUT_PATH("meg.hdr"));
TEST_BOOL(reader != nullptr);
TEST_FAILURE(reader->initialize(fileSpec));
// retrieve the formatted string
const char* str = getLastStatusString(sts);
TEST_BOOL(strcmp(str,"invalid mrsid file format [50607]")==0);
// close up the error string system
TEST_SUCCESS(terminateStatusStrings());
reader->release();
reader = nullptr;
}
lt_uint32 LT_STATUS
An integral status code.
Definition: lt_status.h:30
#define LT_STS_Uninit
status code indicating unintialized variable
Definition: lt_status.h:60
#define LT_STS_Success
status code indicating success
Definition: lt_status.h:43
Status code / error string support.
LT_STATUS initializeStatusStrings()
initialize the status strings reporting system
LT_STATUS terminateStatusStrings()
close out the status strings reporting system
const char * getLastStatusString(LT_STATUS code)
return a formatted status string
Represents a file or directory path.
Definition: lt_fileSpec.h:35
virtual void release(void) const
decrement the reference counter and delete the object when the counter is zero
reader for MrSID images (MG2, MG3 and MG4)
LT_STATUS initialize(const LTFileSpec &fileSpec, bool useWorldFile=false, MrSIDMemoryUsage memoryUsage=MRSID_MEMORY_USAGE_DEFAULT, MrSIDStreamUsage streamUsage=MRSID_STREAM_USAGE_DEFAULT)
initializer
static MrSIDImageReader * create(void)

Extensis