Skip to content

Commit

Permalink
add namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
goccy committed Sep 19, 2018
1 parent b3091f4 commit 337fbca
Show file tree
Hide file tree
Showing 224 changed files with 689 additions and 49 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ set(SOURCES src/application_cache.cc
src/css_rule.cc
src/css_rule_list.cc
src/css_style_declaration.cc
src/css_style_sheet.cc
src/date.cc
src/document.cc
src/document_fragment.cc
Expand Down
2 changes: 2 additions & 0 deletions bind.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#include "libhtml5.h"
#include "class.h"

USING_NAMESPACE_HTML5;

static emscripten::val toString(intptr_t ptr)
{
return emscripten::val(std::string((char *)ptr));
Expand Down
4 changes: 4 additions & 0 deletions include/application_cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

#include "event_target.h"

NAMESPACE_HTML5_BEGIN;

class ApplicationCache : public EventTarget {
public:
enum {
Expand Down Expand Up @@ -30,3 +32,5 @@ class ApplicationCache : public EventTarget {
void swapCache();
void update();
};

NAMESPACE_HTML5_END;
4 changes: 4 additions & 0 deletions include/array.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
#include "object.h"
#include <vector>

NAMESPACE_HTML5_BEGIN;

class Array : public Object {
public:

Expand All @@ -14,3 +16,5 @@ class Array : public Object {
private:
std::vector<Object *> arr;
};

NAMESPACE_HTML5_END;
4 changes: 4 additions & 0 deletions include/array_buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

#include "libhtml5.h"

NAMESPACE_HTML5_BEGIN;

class ArrayBuffer : public Object {
public:
emscripten::val v;
Expand All @@ -16,3 +18,5 @@ class ArrayBuffer : public Object {
ArrayBuffer *slice(long begin);
ArrayBuffer *slice(long begin, long end);
};

NAMESPACE_HTML5_END;
4 changes: 4 additions & 0 deletions include/array_buffer_view.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

#include "libhtml5.h"

NAMESPACE_HTML5_BEGIN;

class ArrayBuffer;

class ArrayBufferView : public Object {
Expand All @@ -16,3 +18,5 @@ class ArrayBufferView : public Object {
virtual ~ArrayBufferView();
static ArrayBufferView *create(emscripten::val v);
};

NAMESPACE_HTML5_END;
4 changes: 4 additions & 0 deletions include/attr.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

#include "libhtml5.h"

NAMESPACE_HTML5_BEGIN;

class Attr : public Object {
public:
emscripten::val v;
Expand All @@ -18,3 +20,5 @@ class Attr : public Object {
static Attr *create(emscripten::val v);
static Attr *create();
};

NAMESPACE_HTML5_END;
4 changes: 4 additions & 0 deletions include/audio_track.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

#include "libhtml5.h"

NAMESPACE_HTML5_BEGIN;

class AudioTrack : public Object {
public:
emscripten::val v;
Expand All @@ -16,3 +18,5 @@ class AudioTrack : public Object {
virtual ~AudioTrack();
static AudioTrack *create(emscripten::val v);
};

NAMESPACE_HTML5_END;
4 changes: 4 additions & 0 deletions include/audio_track_list.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
#include "event_target.h"
#include "event_handler.h"

NAMESPACE_HTML5_BEGIN;

class AudioTrack;

class AudioTrackList : public EventTarget {
Expand All @@ -19,3 +21,5 @@ class AudioTrackList : public EventTarget {
AudioTrack *getter(unsigned long index);
AudioTrack *getTrackById(std::string id);
};

NAMESPACE_HTML5_END;
5 changes: 5 additions & 0 deletions include/auto_release_pool.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
#pragma once

#include "libhtml5.h"
#include <vector>

NAMESPACE_HTML5_BEGIN;

class Object;

class AutoReleasePool {
Expand All @@ -18,3 +21,5 @@ class AutoReleasePool {
private:
std::vector<Object *> objects;
};

NAMESPACE_HTML5_END;
4 changes: 4 additions & 0 deletions include/bar_prop.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

#include "libhtml5.h"

NAMESPACE_HTML5_BEGIN;

class BarProp : public Object {
public:
emscripten::val v;
Expand All @@ -11,3 +13,5 @@ class BarProp : public Object {
virtual ~BarProp();
static BarProp *create(emscripten::val v);
};

NAMESPACE_HTML5_END;
4 changes: 4 additions & 0 deletions include/blob.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

#include "libhtml5.h"

NAMESPACE_HTML5_BEGIN;

class Blob : public Object {
public:
emscripten::val v;
Expand All @@ -16,3 +18,5 @@ class Blob : public Object {
Blob *slice(long long start = 0);
Blob *slice(long long start, long long end, std::string contentType = "");
};

NAMESPACE_HTML5_END;
4 changes: 4 additions & 0 deletions include/canvas_gradient.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

#include "libhtml5.h"

NAMESPACE_HTML5_BEGIN;

class CanvasGradient : public Object {
public:
emscripten::val v;
Expand All @@ -11,3 +13,5 @@ class CanvasGradient : public Object {
static CanvasGradient *create(emscripten::val v);
void addColorStop(double offset, std::string color);
};

NAMESPACE_HTML5_END;
4 changes: 4 additions & 0 deletions include/canvas_pattern.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

#include "libhtml5.h"

NAMESPACE_HTML5_BEGIN;

class SVGMatrix;

class CanvasPattern : public Object {
Expand All @@ -13,3 +15,5 @@ class CanvasPattern : public Object {
static CanvasPattern *create(emscripten::val v);
void setTransform(SVGMatrix *transform);
};

NAMESPACE_HTML5_END;
4 changes: 4 additions & 0 deletions include/canvas_rendering_context_2d.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
#include "rendering_context.h"
#include "canvas_fill_rule.h"

NAMESPACE_HTML5_BEGIN;

class HitRegionOptions;
class HTMLImageElement;
class HTMLVideoElement;
Expand Down Expand Up @@ -135,3 +137,5 @@ class CanvasRenderingContext2D : public RenderingContext {
} strokeStyle{*this};

};

NAMESPACE_HTML5_END;
4 changes: 4 additions & 0 deletions include/character_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

#include "node.h"

NAMESPACE_HTML5_BEGIN;

class Element;

class CharacterData : public Node {
Expand Down Expand Up @@ -40,3 +42,5 @@ class CharacterData : public Node {
void replaceData(unsigned long offset, unsigned long count, std::string data);
std::string substringData(unsigned long offset, unsigned long count);
};

NAMESPACE_HTML5_END;
1 change: 1 addition & 0 deletions include/class.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "css_rule.h"
#include "css_rule_list.h"
#include "css_style_declaration.h"
#include "css_style_sheet.h"
#include "date.h"
#include "document.h"
#include "document_fragment.h"
Expand Down
4 changes: 4 additions & 0 deletions include/comment.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@

#include "character_data.h"

NAMESPACE_HTML5_BEGIN;

class Comment : public CharacterData {
public:

Comment(emscripten::val v);
virtual ~Comment();
static Comment *create(emscripten::val v);
};

NAMESPACE_HTML5_END;
4 changes: 4 additions & 0 deletions include/css_rule.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

#include "libhtml5.h"

NAMESPACE_HTML5_BEGIN;

class CSSStyleSheet;

class CSSRule : public Object {
Expand Down Expand Up @@ -30,3 +32,5 @@ class CSSRule : public Object {
virtual ~CSSRule();
static CSSRule *create(emscripten::val v);
};

NAMESPACE_HTML5_END;
4 changes: 4 additions & 0 deletions include/css_rule_list.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

#include "libhtml5.h"

NAMESPACE_HTML5_BEGIN;

class CSSRule;

class CSSRuleList : public Object {
Expand All @@ -15,3 +17,5 @@ class CSSRuleList : public Object {
static CSSRuleList *create(emscripten::val v);
CSSRule *item(unsigned long index);
};

NAMESPACE_HTML5_END;
4 changes: 4 additions & 0 deletions include/css_style_declaration.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

#include "libhtml5.h"

NAMESPACE_HTML5_BEGIN;

class CSSRule;

class CSSStyleDeclaration : public Object {
Expand All @@ -24,3 +26,5 @@ class CSSStyleDeclaration : public Object {
void setPropertyPriority(std::string property, std::string priority);
void setPropertyValue(std::string property, std::string value);
};

NAMESPACE_HTML5_END;
28 changes: 7 additions & 21 deletions include/css_style_sheet.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,22 @@

#include "style_sheet.h"

NAMESPACE_HTML5_BEGIN;

class CSSRule;
class CSSRuleList;

class CSSStyleSheet : public StyleSheet {
public:
emscripten::val v;
CSSRuleList *_cssRules;
CSSRule *_ownerRule;

HTML5_PROPERTY_OBJECT(CSSStyleSheet, CSSRuleList, cssRules);
HTML5_PROPERTY_OBJECT(CSSStyleSheet, CSSRule, ownerRule);

CSSStyleSheet(emscripten::val v);
virtual ~CSSStyleSheet();
static CSSStyleSheet *create(emscripten::val v);
void deleteRule(unsigned long index);
unsigned long insertRule(std::string rule, unsigned long index);

CSSRuleList *getCSSRules() const;
void setCSSRules(CSSRuleList *value);
CSSRule *getOwnerRule() const;
void setOwnerRule(CSSRule *value);

struct {
CSSStyleSheet &self;
void operator=(CSSRuleList *value) { self.setCSSRules(value); };
operator CSSRuleList *() { return self.getCSSRules(); };
} cssRules{*this};

struct {
CSSStyleSheet &self;
void operator=(CSSRule *value) { self.setOwnerRule(value); };
operator CSSRule *() { return self.getOwnerRule(); };
} ownerRule{*this};

};

NAMESPACE_HTML5_END;
4 changes: 4 additions & 0 deletions include/date.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

#include "libhtml5.h"

NAMESPACE_HTML5_BEGIN;

class Date : public Object {
public:
emscripten::val v;
Expand Down Expand Up @@ -85,3 +87,5 @@ class Date : public Object {
std::string toUTCString();
double valueOf();
};

NAMESPACE_HTML5_END;
4 changes: 4 additions & 0 deletions include/document.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
#include "libhtml5.h"
#include "node.h"

NAMESPACE_HTML5_BEGIN;

class Element;
class HTMLElement;
class HTMLCollection;
Expand Down Expand Up @@ -205,3 +207,5 @@ class Document : public Node {
};
void writeln(std::vector<std::string> texts);
};

NAMESPACE_HTML5_END;
4 changes: 4 additions & 0 deletions include/document_fragment.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

#include "node.h"

NAMESPACE_HTML5_BEGIN;

class HTMLCollection;
class Element;
class NodeList;
Expand Down Expand Up @@ -35,3 +37,5 @@ class DocumentFragment : public Node {
Element *querySelector(std::string selectors);
NodeList *querySelectorAll(std::string selectors);
};

NAMESPACE_HTML5_END;
Loading

0 comments on commit 337fbca

Please sign in to comment.