StringConstructor.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /*
  2. * Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
  3. * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
  4. *
  5. * This library is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU Lesser General Public
  7. * License as published by the Free Software Foundation; either
  8. * version 2 of the License, or (at your option) any later version.
  9. *
  10. * This library is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. * Lesser General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU Lesser General Public
  16. * License along with this library; if not, write to the Free Software
  17. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  18. *
  19. */
  20. #ifndef StringConstructor_h
  21. #define StringConstructor_h
  22. #include "InternalFunction.h"
  23. namespace JSC {
  24. class StringPrototype;
  25. class StringConstructor : public InternalFunction {
  26. public:
  27. typedef InternalFunction Base;
  28. static StringConstructor* create(ExecState* exec, JSGlobalObject* globalObject , Structure* structure, StringPrototype* stringPrototype)
  29. {
  30. StringConstructor* constructor = new (NotNull, allocateCell<StringConstructor>(*exec->heap())) StringConstructor(globalObject, structure);
  31. constructor->finishCreation(exec, stringPrototype);
  32. return constructor;
  33. }
  34. static const ClassInfo s_info;
  35. static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
  36. {
  37. return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), &s_info);
  38. }
  39. protected:
  40. static const unsigned StructureFlags = OverridesGetOwnPropertySlot | InternalFunction::StructureFlags;
  41. private:
  42. StringConstructor(JSGlobalObject*, Structure*);
  43. void finishCreation(ExecState*, StringPrototype*);
  44. static ConstructType getConstructData(JSCell*, ConstructData&);
  45. static CallType getCallData(JSCell*, CallData&);
  46. static bool getOwnPropertySlot(JSCell*, ExecState*, PropertyName, PropertySlot&);
  47. static bool getOwnPropertyDescriptor(JSObject*, ExecState*, PropertyName, PropertyDescriptor&);
  48. };
  49. JSCell* JSC_HOST_CALL stringFromCharCode(ExecState*, int32_t);
  50. } // namespace JSC
  51. #endif // StringConstructor_h