E D R , A S I H C RSS

Civa Project

์ฃผ์š” ์ž๋ฐ” API๋ฅผ C++ ์ฝ”๋“œ๋กœ ๋ฐ”๊ฟ”๋ณด๊ธฐ.

civa.CivaDef

~cpp 
#ifndef CIVA_CIVADEF_INCLUDED
#define CIVA_CIVADEF_INCLUDED
#include <boost/smart_ptr.hpp>

namespace civa { namespace io {
using boost::shared_ptr;

class Serializable;
typedef shared_ptr<Serializable> Serializable_Handle;

}} // namespace civa::io

namespace civa { namespace lang {
using boost::shared_ptr;

template<typename ElementType> class Array;
//#define Array_Handle(ElementType) boost::shared_ptr< civa::lang::Array<ElementType> >
//template<typename ElementType> typedef shared_ptr< Array<ElementType> > Array_Handle;
typedef shared_ptr< Array<char> > charArray_Handle;

class CharSequence;
typedef shared_ptr<CharSequence> CharSequence_Handle;

class Comparable;
typedef shared_ptr<Comparable> Comparable_Handle;

class Object;
typedef shared_ptr<Object> Object_Handle;

class String;
typedef shared_ptr<String> String_Handle;

}} // namespace civa::lang
#endif // CIVA_CIVADEF_INCLUDED

๋ถ„์„ & ์žก๋‹ด

  • ํด๋ž˜์Šค๋“ค์ด ์„œ๋กœ ๋งž๋ฌผ๋ ค์„œ ๊ฒฐ๊ตญ ๋”ฐ๋กœ ๋นผ๊ฒŒ ๋˜์—ˆ๊ตฐ.
  • ํŒŒ๋ผ๋ฉ”ํ„ฐ๋ผ์ด์ฆˆ typedef ์€ ์ปดํŒŒ์ผ์ด ์•ˆ๋˜๋„ค.. ์œผ์œผ Array ์“ธ๋• ๊ธธ๊ฒŒ ๋‹ค ์จ์ค˜์•ผํ•˜๋‚˜..
  • ๋งคํฌ๋กœ๋Š” ์“ฐ๊ธฐ ์‹ซ์€๋ฐ.

civa.io.Serializable

~cpp 
#ifndef CIVA_IO_SERIALIZABLE_INCLUDED
#define CIVA_IO_SERIALIZABLE_INCLUDED
#include "../lang/Object.h"

namespace civa { namespace io {

class Serializable {
};

}} // namespace civa::io
#endif // CIVA_IO_SERIALIZABLE_INCLUDED

๋ถ„์„ & ์žก๋‹ด

  • ์ธ์Šคํ„ด์Šค ์ƒ์„ฑ ๋ชปํ•˜๊ฒŒ ๋ง‰์•„์ค˜์•ผ ํ•˜๋‚˜.

civa.lang.Array

~cpp 
#ifndef CIVA_LANG_ARRAY_INCLUDED
#define CIVA_LANG_ARRAY_INCLUDED
#include "Object.h"

namespace civa { namespace lang {

template<typename ElementType>
class Array : public Object {
  private:
	ElementType* values;
	int length;

  public:
	Array(int length) throw() : length(length) {
		// ๋ฐ”์šด๋“œ ์ฒดํฌ.
		values = new ElementType[length];
	}

	Array(ElementType newValues[]) {
		// ๋ฐฐ์—ด์˜ ํฌ๊ธฐ๊ฐ€ ์ด๊ฒŒ ๋งž๋‚˜...
		length = sizeof(newValues) / sizeof(ElementType);
		values = new ElementType[length];
		for (index = 0; index < length; index++) {
			values[index] = newValuse[index];
		}
	}

	ElementType operator[] (int index) throw() {
		// ๋ฐ”์šด๋“œ ์ฒดํฌ.
		return values[index];
	}

	const ElementType operator[] (int index) const throw() {
		// ๋ฐ”์šด๋“œ ์ฒดํฌ.
		return values[index];
	}

	size_t getLength() {
		return length;
	}

  public:
	~Array() {
		delete[] values;
	}
};


}} // namespace civa::lang
#endif // CIVA_LANG_ARRAY_INCLUDED

๋ถ„์„ & ์žก๋‹ด

  • ๋ฐ”์šด๋“œ ์ฒดํฌํ•ด์„œ ์ต์…‰์…˜ ๋˜์ง€๋Š”๊ฑฐ ํ•ด์•ผํ•˜๊ณ ,
  • ๋ฐฐ์—ด์˜ ํฌ๊ธฐ ์•Œ์•„๋‚ด๋Š” ๋ฒ• ์กฐ์‚ฌ.

civa.lang.CharSequence

~cpp 
#ifndef CIVA_LANG_CHARSEQUENCE_INCLUDED
#define CIVA_LANG_CHARSEQUENCET_INCLUDED
#include "Object.h"

namespace civa { namespace lang {
class CharSequence {
  public:
	virtual int length() = NULL;
	virtual char charAt(int index) = NULL;
	virtual CharSequence_Handle subSequence(int start, int end) = NULL;
	virtual String_Handle toString() = NULL;
};


}} // namespace civa::lang
#endif // CIVA_LANG_CHARSEQUENCET_INCLUDED

๋ถ„์„ & ์žก๋‹ด

  • ์ถ”์ƒํด๋ž˜์Šค๋‹ˆ ์ธ์Šคํ„ด์Šค๋Š” ์ƒ์„ฑ ์•ˆ๋˜๊ฒ ๊ตฐ.

civa.lang.Comparable

~cpp 
#ifndef CIVA_LANG_COMPARABLE_INCLUDED
#define CIVA_LANG_COMPARABLE_INCLUDED
#include "Object.h"

namespace civa { namespace lang {
class Comparable {
  public:
	virtual int compareTo(Object o) = NULL;
};


}} // namespace civa::lang
#endif // CIVA_LANG_COMPARABLE_INCLUDED

๋ถ„์„ & ์žก๋‹ด


civa.lang.Object

~cpp 
#ifndef CIVA_LANG_OBJECT_INCLUDED
#define CIVA_LANG_OBJECT_INCLUDED
#include "../CivaDef.h"

namespace civa { namespace lang {

class Object {
  public:
	void getClass() {/*์ฐจํ›„ ์ถ”๊ฐ€ Class getClass()*/}

	virtual int getHashCode() {
		return reinterpret_cast<int>(this);
	}

	virtual bool equals(Object_Handle obj) {
		return (this == obj.get());
	}

	virtual String_Handle toString() {
		/*์ฐจํ›„ ์ถ”๊ฐ€*/
		//return getClass().getName() + "@" + Integer.toHexString(hashCode());
	}

	void notify() {/*์ฐจํ›„ ์ถ”๊ฐ€*/}

	void notifyAll() {/*์ฐจํ›„ ์ถ”๊ฐ€*/}

	void wait(long timeout) throw() {/*์ฐจํ›„ ์ถ”๊ฐ€*/} //InterruptedException

	void wait(long timeout, int nanos) throw() { //InterruptedException
		if (timeout < 0) {
			throw ;//new IllegalArgumentException("timeout value is negative");
		}

		if (nanos < 0 || nanos > 999999) {
			throw ;//new IllegalArgumentException("nanosecond timeout value out of range");
		}

		if (nanos >= 500000 || (nanos != 0 && timeout == 0)) {
			timeout++;
		}

		wait(timeout);
	}

	void wait() throw() { //InterruptedException
		wait(0);
	}

  protected:
	virtual Object_Handle clone() throw() {
		throw ; //CloneNotSupportedException
		//์œผ์Œ. ํด๋ก ์—์ด๋ธ” ์ธํ„ฐํŽ˜์ด์Šค ๊ตฌํ˜„์—ฌ๋ถ€๋ฅผ ์–ด๋–ป๊ฒŒ ํŒ๋‹จํ•˜์ง€ -_-;;
		return Object_Handle(new Object(*this));
	}

	virtual void finalize() throw() {/*์•„๋ฌด๊ฒƒ๋„ ์•ˆํ•จ*/ } //Throwable

  public:
	virtual ~Object() {}

};


}} // namespace civa::lang
#endif // CIVA_LANG_OBJECT_INCLUDED

๋ถ„์„ & ์žก๋‹ด

  • ์ผ๋‹จ ์‹œ์ž‘... ๋ฉ€ํ‹ฐ์“ฐ๋ ˆ๋“œ ๊ด€๋ จ ๋ฉ”์†Œ๋“œ์™€ ํด๋ž˜์Šค๋Š” ๋ชปํ•  ๋“ฏ. ๊ณผ์—ฐ ์–ด๋””๊นŒ์ง€ ํ• ๋ผ๋‚˜...
  • wait ๋ฉ”์†Œ๋“œ์˜ ์ € ์‚ฌ๊ธฐ ๋‚˜๋…ธ์„ธ์ปจ์„ ๋ณด๋ผ. -_- ์™œ ๋งŒ๋“ ๊ฑฐ์ง€, ๋ฏธ๋ž˜์˜ ๋Œ€๋น„์ธ๊ฐ€...
  • C++ ์—์„œ throw ํƒ€์ž…์„ ๊ณ ์ •์‹œํ‚ฌ ์ˆ˜ ์žˆ๋‚˜...
  • ๋ฉ”์†Œ๋“œ ์˜ค๋ฒ„๋ผ์ด๋”ฉ ๊ธˆ์ง€ ์‹œํ‚ฌ ์ˆ˜ ์žˆ๋‚˜..

civa.lang.String

~cpp 
#ifndef CIVA_LANG_STRING_INCLUDED
#define CIVA_LANG_STRING_INCLUDED
#include "Object.h"
#include "../io/Serializable.h"
#include "Comparable.h"
#include "CharSequence.h"
#include "Array.h"

namespace civa { namespace lang {

class String
: public Object, civa::io::Serializable, Comparable, CharSequence {
  private:
	/** The value is used for character storage. */
	charArray_Handle value;

	/** The offset is the first index of the storage that is used. */
	int offset;

	/** The count is the number of characters in the String. */
	int count;

	/** Cache the hash code for the string */
	int hash;

  public:
	String() : hash(0) {
		value = charArray_Handle(new Array<char>(0));
	}
};

}} // namespace civa::lang
#endif // CIVA_LANG_STRING_INCLUDED

๋ถ„์„ & ์žก๋‹ด


civa.lang.

๋ถ„์„ & ์žก๋‹ด

WIPI ์—์„œ ATOC ๋ฅผ ์ง€๊ธˆ ๋„ค๊ฐ€ ํ•˜๋Š”๊ฒƒ์ฒ˜๋Ÿผ ์ˆ˜ํ–‰ํ•œ๋‹ค๋”๊ตฌ๋งŒ --;; .. --neocoin

Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:22:53
Processing time 0.0046 sec