imgtools/romtools/rofsbuild/src/cache/cacheexception.cpp
author y4jin
Thu, 18 Nov 2010 13:41:24 +0800
changeset 703 a23be6984256
parent 600 6d08f4a05d93
permissions -rw-r--r--
Fix the illegal word scanned by sfchecksource tools
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
600
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
     1
/*
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
     2
* Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
     3
* All rights reserved.
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
     4
* This component and the accompanying materials are made available
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
     5
* under the terms of the License "Eclipse Public License v1.0"
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
     6
* which accompanies this distribution, and is available
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
     8
*
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
     9
* Initial Contributors:
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    11
*
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    12
* Contributors:
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    13
*
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    14
* Description: 
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    15
*
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    16
*/
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    17
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    18
#include "cache/cacheexception.hpp"
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    19
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    20
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    21
int CacheException::EPOCROOT_NOT_FOUND          = 1;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    22
int CacheException::RESOURCE_ALLOCATION_FAILURE = 2;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    23
int CacheException::CACHE_NOT_FOUND             = 3;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    24
int CacheException::CACHE_INVALID               = 4;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    25
int CacheException::CACHE_IS_EMPTY              = 5;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    26
int CacheException::HARDDRIVE_FAILURE           = 6;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    27
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    28
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    29
CacheException::CacheException(int ErrorCode)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    30
{
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    31
	this->errcode = ErrorCode;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    32
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    33
	return;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    34
}
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    35
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    36
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    37
int CacheException::GetErrorCode(void)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    38
{
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    39
	return this->errcode;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    40
}
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    41
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    42
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    43
const char* CacheException::GetErrorMessage(void)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    44
{
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    45
	if(this->errcode == CacheException::EPOCROOT_NOT_FOUND)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    46
		return "EPOCROOT environment variable is not set.";
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    47
	else if(this->errcode == CacheException::RESOURCE_ALLOCATION_FAILURE)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    48
		return "Not enough system resources to initialize cache module.";
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    49
	else if(this->errcode == CacheException::CACHE_NOT_FOUND)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    50
		return "Cache is not present in the current system.";
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    51
	else if(this->errcode == CacheException::CACHE_INVALID)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    52
		return "Cache is invalid.";
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    53
	else if(this->errcode == CacheException::CACHE_IS_EMPTY)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    54
		return "Cache is empty.";
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    55
	else if(this->errcode == CacheException::HARDDRIVE_FAILURE)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    56
		return "A hard drive failure occurred in Cache operations.";
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    57
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    58
	return "Undefined error type.";
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    59
}
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    60
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    61
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    62
CacheException::~CacheException(void)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    63
{
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    64
	return;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    65
}