mirror of
https://github.com/SWG-Source/src.git
synced 2026-07-29 23:15:56 -04:00
Added localizationArchive library
This commit is contained in:
Vendored
+1
@@ -2,5 +2,6 @@
|
||||
add_subdirectory(archive)
|
||||
add_subdirectory(fileInterface)
|
||||
add_subdirectory(localization)
|
||||
add_subdirectory(localizationArchive)
|
||||
add_subdirectory(unicode)
|
||||
add_subdirectory(unicodeArchive)
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
cmake_minimum_required(VERSION 2.8)
|
||||
|
||||
project(localizationArchive)
|
||||
|
||||
if(WIN32)
|
||||
add_definitions(/D_CRT_SECURE_NO_WARNINGS)
|
||||
endif()
|
||||
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include/public)
|
||||
|
||||
add_subdirectory(src)
|
||||
+1
@@ -0,0 +1 @@
|
||||
#include "../../src/shared/FirstLocalizationArchive.h"
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
#include "../../src/shared/StringIdArchive.h"
|
||||
@@ -0,0 +1,29 @@
|
||||
|
||||
|
||||
set(SHARED_SOURCES
|
||||
shared/FirstLocalizationArchive.h
|
||||
shared/StringIdArchive.cpp
|
||||
shared/StringIdArchive.h
|
||||
)
|
||||
|
||||
if(WIN32)
|
||||
set(PLATFORM_SOURCES
|
||||
win32/FirstLocalizationArchive.cpp
|
||||
)
|
||||
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/win32)
|
||||
else()
|
||||
set(PLATFORM_SOURCES "")
|
||||
endif()
|
||||
|
||||
include_directories(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/shared
|
||||
${SWG_EXTERNALS_SOURCE_DIR}/ours/library/archive/include
|
||||
${SWG_EXTERNALS_SOURCE_DIR}/ours/library/localization/include
|
||||
${SWG_EXTERNALS_SOURCE_DIR}/ours/library/unicode/include
|
||||
)
|
||||
|
||||
add_library(localizationArchive
|
||||
${SHARED_SOURCES}
|
||||
${PLATFORM_SOURCES}
|
||||
)
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
//======================================================================
|
||||
//
|
||||
// FirstLocalizationArchive.h
|
||||
// copyright (c) 2002 Sony Online Entertainment
|
||||
//
|
||||
//======================================================================
|
||||
|
||||
#ifndef INCLUDED_FirstLocalizationArchive_H
|
||||
#define INCLUDED_FirstLocalizationArchive_H
|
||||
|
||||
//======================================================================
|
||||
|
||||
#ifdef WIN32
|
||||
// C4702 unreachable code
|
||||
#pragma warning (disable:4702)
|
||||
#endif
|
||||
|
||||
#include "Unicode.h"
|
||||
#include "Archive/Archive.h"
|
||||
|
||||
//======================================================================
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,57 @@
|
||||
//======================================================================
|
||||
//
|
||||
// StringIdArchive.cpp
|
||||
// copyright (c) 2002 Sony Online Entertainment
|
||||
//
|
||||
//======================================================================
|
||||
|
||||
#include "localizationArchive/FirstLocalizationArchive.h"
|
||||
#include "localizationArchive/StringIdArchive.h"
|
||||
|
||||
#include "StringId.h"
|
||||
#include "Archive/Archive.h"
|
||||
#include "Archive/ByteStream.h"
|
||||
|
||||
//======================================================================
|
||||
|
||||
namespace Archive
|
||||
{
|
||||
/**
|
||||
* Retrieves a StringId from the a data buffer.
|
||||
*
|
||||
* @param source the source buffer
|
||||
*/
|
||||
void get(ReadIterator & source, StringId & target)
|
||||
{
|
||||
unsigned long index = 0;
|
||||
std::string table;
|
||||
std::string name;
|
||||
|
||||
Archive::get(source, table);
|
||||
Archive::get(source, index);
|
||||
Archive::get(source, name);
|
||||
|
||||
target.setTable (table);
|
||||
target.setText (name);
|
||||
|
||||
//-- getting the index over the wire is potentially problematic
|
||||
target.setTextIndex (0);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Add a StringId to a data buffer.
|
||||
*
|
||||
* @param target the buffer to fill
|
||||
*/
|
||||
|
||||
void put(ByteStream & target, const StringId & source)
|
||||
{
|
||||
Archive::put(target, source.getTable ());
|
||||
Archive::put(target, source.getTextIndex ());
|
||||
Archive::put(target, source.getText ());
|
||||
}
|
||||
}
|
||||
|
||||
//======================================================================
|
||||
@@ -0,0 +1,28 @@
|
||||
// StringIdArchive.h
|
||||
// copyright 2001 Verant Interactive
|
||||
|
||||
#ifndef _INCLUDED_StringIdArchive_H
|
||||
#define _INCLUDED_StringIdArchive_H
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
class StringId;
|
||||
|
||||
namespace Archive
|
||||
{
|
||||
class ReadIterator;
|
||||
class ByteStream;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
namespace Archive
|
||||
{
|
||||
void get(ReadIterator & source, StringId & target);
|
||||
|
||||
void put(ByteStream & target, const StringId & source);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
#endif
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
//======================================================================
|
||||
//
|
||||
// FirstLocalizationArchive.cpp
|
||||
// copyright (c) 2002 Sony Online Entertainment
|
||||
//
|
||||
//======================================================================
|
||||
|
||||
#include "localizationArchive/FirstLocalizationArchive.h"
|
||||
|
||||
//======================================================================
|
||||
Reference in New Issue
Block a user