/* Generated automatically by jlpp - do not edit. */ #include static jakelib::lang::String* jakelib2_strings[] = {null, null}; // "Unknown Source" static jchar chars_jakelib2_str_0[] = {85,110,107,110,111,119,110,32,83,111,117,114,99,101}; // "jakelib.lang.StackTraceElement" static jchar chars_jakelib2_str_1[] = {106,97,107,101,108,105,98,46,108,97,110,103,46,83,116,97,99,107,84,114,97,99,101,69,108,101,109,101,110,116}; #line 1 "lang/StackTraceElement.jlc" // -*- c++ -*- /* * Jakelib2 - General purpose C++ library * Copyright (C) 2001 Florian Wolff (florian@donuz.de) * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * $Id: StackTraceElement.jlc,v 1.13 2003/10/07 17:42:10 florian Exp $ */ #include "jakelib2.h" #include "jakelib2/lang/Thread.h" #include "jakelib2/lang/StackTrace.h" #include "jakelib2/lang/StackTraceElement.h" #include "jakelib2/lang/System.h" using namespace jakelib::lang; using namespace jakelib::util; JAKELIB_IMPLEMENT_CLASS_1("jakelib.lang.StackTraceElement", StackTraceElement, Object, Serializable); JAKELIB_IMPLEMENT_ARRAY(StackTraceElement); /*****************************************************************************\ * StackTraceElement | *****************************************************************************/ StackTraceElement::StackTraceElement(String* className, String* methodName, String* fileName, int lineNumber) { this->fileName = fileName; this->lineNumber = lineNumber; this->className = className; this->methodName = methodName; } /*****************************************************************************\ * getFileName | *****************************************************************************/ String* StackTraceElement::getFileName() { return fileName; } /*****************************************************************************\ * getLineNumber | *****************************************************************************/ jint StackTraceElement::getLineNumber() { return lineNumber; } /*****************************************************************************\ * getClassName | *****************************************************************************/ String* StackTraceElement::getClassName() { return className; } /*****************************************************************************\ * getMethodName | *****************************************************************************/ String* StackTraceElement::getMethodName() { return methodName; } /*****************************************************************************\ * toString | *****************************************************************************/ String* StackTraceElement::toString() { StringBuffer sb; if (className != null) { sb.append(className); if (methodName != null) sb.append(':')->append(':'); } if (methodName != null) sb.append(methodName); sb.append('('); if (fileName != null) sb.append(fileName); else sb.append(JAKELIB_ONDEMAND(jakelib2_strings[0], new jakelib::lang::String(chars_jakelib2_str_0, 0, 14))); if (lineNumber >= 0) { sb.append(':'); sb.append(lineNumber); } sb.append(')'); return sb.toString(); } /*****************************************************************************\ * equals | *****************************************************************************/ jboolean StackTraceElement::equals(Object* o) { if (!(o->instanceOf(JAKELIB_ONDEMAND(jakelib2_strings[1], new jakelib::lang::String(chars_jakelib2_str_1, 0, 30))))) return false; StackTraceElement* e = (StackTraceElement*) o; return equals(fileName, e->fileName) && lineNumber == e->lineNumber && equals(className, e->className) && equals(methodName, e->methodName); } /*****************************************************************************\ * hashCode | *****************************************************************************/ jint StackTraceElement::hashCode() { return hashCode(fileName) ^ lineNumber ^ hashCode(className) ^ hashCode(methodName); } /*****************************************************************************\ * equals | *****************************************************************************/ jboolean StackTraceElement::equals(Object* o1, Object* o2) { return o1 == null ? o2 == null : o1->equals(o2); } /*****************************************************************************\ * hashCode | *****************************************************************************/ jint StackTraceElement::hashCode(Object* o) { return o == null ? 0 : o->hashCode(); } /*****************************************************************************\ * TmpStackTraceElement | *****************************************************************************/ TmpStackTraceElement::TmpStackTraceElement(char *methodName, char *fileName, int lineNumber) { this->fileName = fileName; this->lineNumber = lineNumber; this->methodName = methodName; // StackTrace *stackTrace = Thread::currentThread()->getStackTrace(); // if (stackTrace != null) // stackTrace->push(this); } TmpStackTraceElement::~TmpStackTraceElement() { //Thread::currentThread()->getStackTrace()->pop(); }