Cleanup: Delete SkJSON header.
It seems it does not have any implementation so it is unlikely it will have any user, either internal or external. BUG=None TEST=make all R=bsalomon@google.com, mtklein@google.com Author: tfarina@chromium.org Review URL: https://codereview.chromium.org/353183006
This commit is contained in:
parent
50a7b0e621
commit
10722184fd
@ -107,41 +107,49 @@
|
||||
'effects/SkLightingImageFilter.h',
|
||||
'effects/SkDropShadowImageFilter.h',
|
||||
'effects/SkMatrixConvolutionImageFilter.h',
|
||||
'utils/SkBoundaryPatch.h',
|
||||
'utils/SkCamera.h',
|
||||
'utils/SkCubicInterval.h',
|
||||
'utils/SkCullPoints.h',
|
||||
'utils/SkDebugUtils.h',
|
||||
'utils/SkDeferredCanvas.h',
|
||||
'utils/SkDumpCanvas.h',
|
||||
'utils/SkDumpCanvas.h',
|
||||
'utils/SkInterpolator.h',
|
||||
'utils/SkInterpolator.h',
|
||||
'utils/SkLayer.h',
|
||||
'utils/SkLua.h',
|
||||
'utils/SkLua.h',
|
||||
'utils/SkLuaCanvas.h',
|
||||
'utils/SkMatrix44.h',
|
||||
'utils/SkMatrix44.h',
|
||||
'utils/SkMeshUtils.h',
|
||||
'utils/SkNWayCanvas.h',
|
||||
'utils/SkNinePatch.h',
|
||||
'utils/SkNullCanvas.h',
|
||||
'utils/SkParse.h',
|
||||
'utils/SkParse.h',
|
||||
'utils/SkParsePaint.h',
|
||||
'utils/SkParsePaint.h',
|
||||
'utils/SkParsePath.h',
|
||||
'utils/SkPathUtils.h',
|
||||
'utils/SkPictureUtils.h',
|
||||
'utils/SkProxyCanvas.h',
|
||||
'utils/SkRTConf.h',
|
||||
'utils/SkRTConf.h',
|
||||
'utils/SkRandom.h',
|
||||
'utils/SkRunnable.h',
|
||||
'utils/SkRunnable.h',
|
||||
'utils/SkThreadPool.h',
|
||||
'utils/SkThreadPool.h',
|
||||
'utils/SkWGL.h',
|
||||
'utils/SkWGL.h',
|
||||
'utils/ios/SkStream_NSData.h',
|
||||
'utils/mac/SkCGUtils.h',
|
||||
'utils/win/SkAutoCoInitialize.h',
|
||||
'utils/win/SkHRESULT.h',
|
||||
'utils/win/SkIStream.h',
|
||||
'utils/win/SkTScopedComPtr.h',
|
||||
'utils/SkBoundaryPatch.h',
|
||||
'utils/SkPictureUtils.h',
|
||||
'utils/SkRandom.h',
|
||||
'utils/SkMeshUtils.h',
|
||||
'utils/SkCullPoints.h',
|
||||
'utils/SkCamera.h',
|
||||
'utils/SkLua.h',
|
||||
'utils/SkParsePaint.h',
|
||||
'utils/SkRunnable.h',
|
||||
'utils/SkParse.h',
|
||||
'utils/SkThreadPool.h',
|
||||
'utils/SkMatrix44.h',
|
||||
'utils/SkInterpolator.h',
|
||||
'utils/SkWGL.h',
|
||||
'utils/SkDumpCanvas.h',
|
||||
'utils/SkRTConf.h',
|
||||
'utils/SkCubicInterval.h',
|
||||
'utils/SkLuaCanvas.h',
|
||||
'utils/SkDebugUtils.h',
|
||||
'utils/SkLayer.h',
|
||||
'utils/SkProxyCanvas.h',
|
||||
'utils/SkNWayCanvas.h',
|
||||
'utils/SkPathUtils.h',
|
||||
'utils/SkDeferredCanvas.h',
|
||||
'utils/ios/SkStream_NSData.h',
|
||||
'utils/SkNullCanvas.h',
|
||||
'utils/SkParsePath.h',
|
||||
'utils/SkJSON.h',
|
||||
'utils/SkCondVar.h',
|
||||
'utils/SkNinePatch.h',
|
||||
'utils/mac/SkCGUtils.h',
|
||||
'xml/SkDOM.h',
|
||||
'xml/SkJS.h',
|
||||
'xml/SkXMLParser.h',
|
||||
|
@ -1,285 +0,0 @@
|
||||
/*
|
||||
* Copyright 2011 Google Inc.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license that can be
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
|
||||
#ifndef SkJSON_DEFINED
|
||||
#define SkJSON_DEFINED
|
||||
|
||||
#include "SkTypes.h"
|
||||
|
||||
class SkStream;
|
||||
class SkString;
|
||||
|
||||
class SkJSON {
|
||||
public:
|
||||
enum Type {
|
||||
kObject,
|
||||
kArray,
|
||||
kString,
|
||||
kInt,
|
||||
kFloat,
|
||||
kBool,
|
||||
};
|
||||
|
||||
class Array;
|
||||
|
||||
class Object {
|
||||
private:
|
||||
struct Slot;
|
||||
|
||||
public:
|
||||
Object();
|
||||
Object(const Object&);
|
||||
~Object();
|
||||
|
||||
/**
|
||||
* Create a new slot with the specified name and value. The name
|
||||
* parameter is copied, but ownership of the Object parameter is
|
||||
* transferred. The Object parameter may be null, but the name must
|
||||
* not be null.
|
||||
*/
|
||||
void addObject(const char name[], Object* value);
|
||||
|
||||
/**
|
||||
* Create a new slot with the specified name and value. The name
|
||||
* parameter is copied, but ownership of the Array parameter is
|
||||
* transferred. The Array parameter may be null, but the name must
|
||||
* not be null.
|
||||
*/
|
||||
void addArray(const char name[], Array* value);
|
||||
|
||||
/**
|
||||
* Create a new slot with the specified name and value. Both parameters
|
||||
* are copied. The value parameter may be null, but the name must
|
||||
* not be null.
|
||||
*/
|
||||
void addString(const char name[], const char value[]);
|
||||
|
||||
/**
|
||||
* Create a new slot with the specified name and value. The name
|
||||
* parameter is copied, and must not be null.
|
||||
*/
|
||||
void addInt(const char name[], int32_t value);
|
||||
|
||||
/**
|
||||
* Create a new slot with the specified name and value. The name
|
||||
* parameter is copied, and must not be null.
|
||||
*/
|
||||
void addFloat(const char name[], float value);
|
||||
|
||||
/**
|
||||
* Create a new slot with the specified name and value. The name
|
||||
* parameter is copied, and must not be null.
|
||||
*/
|
||||
void addBool(const char name[], bool value);
|
||||
|
||||
/**
|
||||
* Return the number of slots/fields in this object. These can be
|
||||
* iterated using Iter.
|
||||
*/
|
||||
int count() const;
|
||||
|
||||
/**
|
||||
* Returns true if a slot matching the name and Type is found.
|
||||
*/
|
||||
bool find(const char name[], Type) const;
|
||||
bool findObject(const char name[], Object** = NULL) const;
|
||||
bool findArray(const char name[], Array** = NULL) const;
|
||||
bool findString(const char name[], SkString* = NULL) const;
|
||||
bool findInt(const char name[], int32_t* = NULL) const;
|
||||
bool findFloat(const char name[], float* = NULL) const;
|
||||
bool findBool(const char name[], bool* = NULL) const;
|
||||
|
||||
/**
|
||||
* Finds the first slot matching the name and Type and removes it.
|
||||
* Returns true if found, false if not.
|
||||
*/
|
||||
bool remove(const char name[], Type);
|
||||
|
||||
void toDebugf() const;
|
||||
|
||||
/**
|
||||
* Iterator class which returns all of the fields/slots in an Object,
|
||||
* in the order that they were added.
|
||||
*/
|
||||
class Iter {
|
||||
public:
|
||||
Iter(const Object&);
|
||||
|
||||
/**
|
||||
* Returns true when there are no more entries in the iterator.
|
||||
* In this case, no other methods should be called.
|
||||
*/
|
||||
bool done() const;
|
||||
|
||||
/**
|
||||
* Moves the iterator to the next element. Should only be called
|
||||
* if done() returns false.
|
||||
*/
|
||||
void next();
|
||||
|
||||
/**
|
||||
* Returns the type of the current element. Should only be called
|
||||
* if done() returns false.
|
||||
*/
|
||||
Type type() const;
|
||||
|
||||
/**
|
||||
* Returns the name of the current element. Should only be called
|
||||
* if done() returns false.
|
||||
*/
|
||||
const char* name() const;
|
||||
|
||||
/**
|
||||
* Returns the type of the current element. Should only be called
|
||||
* if done() returns false and type() returns kObject.
|
||||
*/
|
||||
Object* objectValue() const;
|
||||
|
||||
/**
|
||||
* Returns the type of the current element. Should only be called
|
||||
* if done() returns false and type() returns kArray.
|
||||
*/
|
||||
Array* arrayValue() const;
|
||||
|
||||
/**
|
||||
* Returns the type of the current element. Should only be called
|
||||
* if done() returns false and type() returns kString.
|
||||
*/
|
||||
const char* stringValue() const;
|
||||
|
||||
/**
|
||||
* Returns the type of the current element. Should only be called
|
||||
* if done() returns false and type() returns kInt.
|
||||
*/
|
||||
int32_t intValue() const;
|
||||
|
||||
/**
|
||||
* Returns the type of the current element. Should only be called
|
||||
* if done() returns false and type() returns kFloat.
|
||||
*/
|
||||
float floatValue() const;
|
||||
|
||||
/**
|
||||
* Returns the type of the current element. Should only be called
|
||||
* if done() returns false and type() returns kBool.
|
||||
*/
|
||||
bool boolValue() const;
|
||||
|
||||
private:
|
||||
Slot* fSlot;
|
||||
};
|
||||
|
||||
private:
|
||||
Slot* fHead;
|
||||
Slot* fTail;
|
||||
|
||||
const Slot* findSlot(const char name[], Type) const;
|
||||
Slot* addSlot(Slot*);
|
||||
void dumpLevel(int level) const;
|
||||
|
||||
friend class Array;
|
||||
};
|
||||
|
||||
class Array {
|
||||
public:
|
||||
/**
|
||||
* Creates an array with the specified Type and element count. All
|
||||
* entries are initialized to NULL/0/false.
|
||||
*/
|
||||
Array(Type, int count);
|
||||
|
||||
/**
|
||||
* Creates an array of ints, initialized by copying the specified
|
||||
* values.
|
||||
*/
|
||||
Array(const int32_t values[], int count);
|
||||
|
||||
/**
|
||||
* Creates an array of floats, initialized by copying the specified
|
||||
* values.
|
||||
*/
|
||||
Array(const float values[], int count);
|
||||
|
||||
/**
|
||||
* Creates an array of bools, initialized by copying the specified
|
||||
* values.
|
||||
*/
|
||||
Array(const bool values[], int count);
|
||||
|
||||
Array(const Array&);
|
||||
~Array();
|
||||
|
||||
int count() const { return fCount; }
|
||||
Type type() const { return fType; }
|
||||
|
||||
/**
|
||||
* Replace the element at the specified index with the specified
|
||||
* Object (which may be null). Ownership of the Object is transferred.
|
||||
* Should only be called if the Array's type is kObject.
|
||||
*/
|
||||
void setObject(int index, Object*);
|
||||
|
||||
/**
|
||||
* Replace the element at the specified index with the specified
|
||||
* Array (which may be null). Ownership of the Array is transferred.
|
||||
* Should only be called if the Array's type is kArray.
|
||||
*/
|
||||
void setArray(int index, Array*);
|
||||
|
||||
/**
|
||||
* Replace the element at the specified index with a copy of the
|
||||
* specified string (which may be null). Should only be called if the
|
||||
* Array's type is kString.
|
||||
*/
|
||||
void setString(int index, const char str[]);
|
||||
|
||||
Object* const* objects() const {
|
||||
SkASSERT(kObject == fType);
|
||||
return fArray.fObjects;
|
||||
}
|
||||
Array* const* arrays() const {
|
||||
SkASSERT(kObject == fType);
|
||||
return fArray.fArrays;
|
||||
}
|
||||
const char* const* strings() const {
|
||||
SkASSERT(kString == fType);
|
||||
return fArray.fStrings;
|
||||
}
|
||||
int32_t* ints() const {
|
||||
SkASSERT(kInt == fType);
|
||||
return fArray.fInts;
|
||||
}
|
||||
float* floats() const {
|
||||
SkASSERT(kFloat == fType);
|
||||
return fArray.fFloats;
|
||||
}
|
||||
bool* bools() const {
|
||||
SkASSERT(kBool == fType);
|
||||
return fArray.fBools;
|
||||
}
|
||||
|
||||
private:
|
||||
int fCount;
|
||||
Type fType;
|
||||
union {
|
||||
void* fVoids;
|
||||
Object** fObjects;
|
||||
Array** fArrays;
|
||||
char** fStrings;
|
||||
int32_t* fInts;
|
||||
float* fFloats;
|
||||
bool* fBools;
|
||||
} fArray;
|
||||
|
||||
void init(Type, int count, const void* src);
|
||||
void dumpLevel(int level) const;
|
||||
|
||||
friend class Object;
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user