Change comment format to support automatic document generation using the CppDoc application.

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@249 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt 2011-05-31 17:12:37 +00:00
parent 3a6ddf782a
commit 2779179489
19 changed files with 2336 additions and 149 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -33,15 +33,17 @@
#include "internal/cef_nplugin_types.h"
///
// Netscape plugins are normally built at separate DLLs that are loaded by the
// browser when needed. This interface supports the creation of plugins that
// are an embedded component of the application. Embedded plugins built using
// this interface use the same Netscape Plugin API as DLL-based plugins.
// See https://developer.mozilla.org/En/Gecko_Plugin_API_Reference for complete
// documentation on how to use the Netscape Plugin API.
//
// This class provides attribute information and entry point functions for a
// plugin.
///
class CefPluginInfo : public cef_plugin_info_t
{
public:
@ -111,7 +113,9 @@ protected:
}
};
///
// Register a plugin with the system.
///
bool CefRegisterPlugin(const CefPluginInfo& plugin_info);
#endif // _CEF_NPLUGIN_H

View File

@ -37,7 +37,9 @@ extern "C" {
#include "internal/cef_nplugin_types.h"
///
// Register a plugin with the system. Returns true (1) on success.
///
CEF_EXPORT int cef_register_plugin(const cef_plugin_info_t* plugin_info);
#ifdef __cplusplus

View File

@ -40,11 +40,12 @@
#include <map>
#include <vector>
///
// Thread safe class for representing XML data as a structured object. This
// class should not be used with large XML documents because all data will be
// resident in memory at the same time. This implementation supports a
// restricted set of XML features:
// <pre>
// (1) Processing instructions, whitespace and comments are ignored.
// (2) Elements and attributes must always be referenced using the fully
// qualified name (ie, namespace:localname).
@ -60,59 +61,81 @@
// (b) Entity reference nodes are resolved to the corresponding entity
// value.
// (c) Element nodes are represented by their outer XML string.
// </pre>
///
class CefXmlObject : public CefBase
{
public:
typedef std::vector<CefRefPtr<CefXmlObject> > ObjectVector;
typedef std::map<CefString, CefString > AttributeMap;
///
// Create a new object with the specified name. An object name must always be
// at least one character long.
///
CefXmlObject(const CefString& name);
virtual ~CefXmlObject();
///
// Load the contents of the specified XML stream into this object. The
// existing children and attributes, if any, will first be cleared.
///
bool Load(CefRefPtr<CefStreamReader> stream,
CefXmlReader::EncodingType encodingType,
const CefString& URI, CefString* loadError);
///
// Set the name, children and attributes of this object to a duplicate of the
// specified object's contents. The existing children and attributes, if any,
// will first be cleared.
///
void Set(CefRefPtr<CefXmlObject> object);
///
// Append a duplicate of the children and attributes of the specified object
// to this object. If |overwriteAttributes| is true then any attributes in
// this object that also exist in the specified object will be overwritten
// with the new values. The name of this object is not changed.
///
void Append(CefRefPtr<CefXmlObject> object, bool overwriteAttributes);
///
// Return a new object with the same name, children and attributes as this
// object. The parent of the new object will be NULL.
///
CefRefPtr<CefXmlObject> Duplicate();
///
// Clears this object's children and attributes. The name and parenting of
// this object are not changed.
///
void Clear();
///
// Access the object's name. An object name must always be at least one
// character long.
///
CefString GetName();
bool SetName(const CefString& name);
///
// Access the object's parent. The parent can be NULL if this object has not
// been added as the child on another object.
///
bool HasParent();
CefRefPtr<CefXmlObject> GetParent();
///
// Access the object's value. An object cannot have a value if it also has
// children. Attempting to set the value while children exist will fail.
///
bool HasValue();
CefString GetValue();
bool SetValue(const CefString& value);
///
// Access the object's attributes. Attributes must have unique names.
///
bool HasAttributes();
size_t GetAttributeCount();
bool HasAttribute(const CefString& name);
@ -121,11 +144,13 @@ public:
size_t GetAttributes(AttributeMap& attributes);
void ClearAttributes();
///
// Access the object's children. Each object can only have one parent so
// attempting to add an object that already has a parent will fail. Removing a
// child will set the child's parent to NULL. Adding a child will set the
// child's parent to this object. This object's value, if any, will be cleared
// if a child is added.
///
bool HasChildren();
size_t GetChildCount();
bool HasChild(CefRefPtr<CefXmlObject> child);
@ -134,10 +159,14 @@ public:
size_t GetChildren(ObjectVector& children);
void ClearChildren();
///
// Find the first child with the specified name.
///
CefRefPtr<CefXmlObject> FindChild(const CefString& name);
///
// Find all children with the specified name.
///
size_t FindChildren(const CefString& name, ObjectVector& children);
private:
@ -154,28 +183,40 @@ private:
};
///
// Thread safe implementation of the CefReadHandler class for reading an
// in-memory array of bytes.
///
class CefByteReadHandler : public CefReadHandler
{
public:
///
// Create a new object for reading an array of bytes. An optional |source|
// reference can be kept to keep the underlying data source from being
// released while the reader exists.
///
CefByteReadHandler(const unsigned char* bytes, size_t size,
CefRefPtr<CefBase> source);
///
// Read raw binary data.
///
virtual size_t Read(void* ptr, size_t size, size_t n);
///
// Seek to the specified offset position. |whence| may be any one of
// SEEK_CUR, SEEK_END or SEEK_SET.
///
virtual int Seek(long offset, int whence);
///
// Return the current offset position.
///
virtual long Tell();
///
// Return non-zero if at end of file.
///
virtual int Eof();
private:
@ -189,6 +230,7 @@ private:
};
///
// Thread-safe class for accessing zip archive file contents. This class should
// not be used with large archive files because all data will be resident in
// memory at the same time. This implementation supports a restricted set of zip
@ -198,51 +240,76 @@ private:
// (3) File ordering from the original zip archive is not maintained. This
// means that files from the same folder may not be located together in the
// file content map.
///
class CefZipArchive : public CefBase
{
public:
///
// Class representing a file in the archive. Accessing the file data from
// multiple threads is safe provided a reference to the File object is kept.
///
class File : public CefBase
{
public:
///
// Returns the read-only data contained in the file.
///
virtual const unsigned char* GetData() =0;
///
// Returns the size of the data in the file.
///
virtual size_t GetDataSize() =0;
///
// Returns a CefStreamReader object for streaming the contents of the file.
///
virtual CefRefPtr<CefStreamReader> GetStreamReader() =0;
};
typedef std::map<CefString, CefRefPtr<File> > FileMap;
///
// Create a new object.
///
CefZipArchive();
virtual ~CefZipArchive();
///
// Load the contents of the specified zip archive stream into this object.
// If |overwriteExisting| is true then any files in this object that also
// exist in the specified archive will be replaced with the new files.
// Returns the number of files successfully loaded.
///
size_t Load(CefRefPtr<CefStreamReader> stream, bool overwriteExisting);
///
// Clears the contents of this object.
///
void Clear();
///
// Returns the number of files in the archive.
///
size_t GetFileCount();
///
// Returns true if the specified file exists and has contents.
///
bool HasFile(const CefString& fileName);
///
// Returns the specified file.
///
CefRefPtr<File> GetFile(const CefString& fileName);
///
// Removes the specified file.
///
bool RemoveFile(const CefString& fileName);
///
// Returns the map of all files.
///
size_t GetFiles(FileMap& map);
private:

View File

@ -32,13 +32,14 @@
#ifndef _CEF_PTR_H
#define _CEF_PTR_H
///
// Smart pointer implementation borrowed from base/ref_counted.h
//
// <p>
// A smart pointer class for reference counted objects. Use this class instead
// of calling AddRef and Release manually on a reference counted object to
// avoid common memory leaks caused by forgetting to Release an object
// reference. Sample usage:
//
// <pre>
// class MyFoo : public CefBase {
// ...
// };
@ -59,11 +60,11 @@
// if (foo)
// foo->Method(param);
// }
//
// </pre>
// The above examples show how CefRefPtr<T> acts like a pointer to T.
// Given two CefRefPtr<T> classes, it is also possible to exchange
// references between the two objects, like so:
//
// <pre>
// {
// CefRefPtr<MyFoo> a = new MyFoo();
// CefRefPtr<MyFoo> b;
@ -71,10 +72,10 @@
// b.swap(a);
// // now, |b| references the MyFoo object, and |a| references NULL.
// }
//
// </pre>
// To make both |a| and |b| in the above example reference the same MyFoo
// object, simply use the assignment operator:
//
// <pre>
// {
// CefRefPtr<MyFoo> a = new MyFoo();
// CefRefPtr<MyFoo> b;
@ -83,10 +84,10 @@
// // now, |a| and |b| each own a reference to the same MyFoo object.
// // the reference count of the underlying MyFoo object will be 2.
// }
//
// </pre>
// Reference counted objects can also be passed as function parameters and
// used as function return values:
//
// <pre>
// void some_func_with_param(CefRefPtr<MyFoo> param) {
// // A reference is added to the MyFoo object that |param| represents
// // during the scope of some_func_with_param() and released when
@ -121,9 +122,9 @@
// // return value, the MyFoo object created in some_func_with_retval()
// // will automatically be released.
// }
//
// </pre>
// And in standard containers:
//
// <pre>
// {
// // Create a vector that holds MyFoo objects.
// std::vector<CefRefPtr<MyFoo> > MyFooVec;
@ -136,7 +137,9 @@
// // is increased to 2.
// MyFooVec.push_back(foo);
// }
//
// </pre>
// </p>
///
template <class T>
class CefRefPtr {
public:

View File

@ -48,10 +48,10 @@
#ifdef __cplusplus
#include "cef_string_wrappers.h"
#if defined(CEF_STRING_TYPE_UTF8)
typedef CefStringUTF8 CefString;
#elif defined(CEF_STRING_TYPE_UTF16)
#if defined(CEF_STRING_TYPE_UTF16)
typedef CefStringUTF16 CefString;
#elif defined(CEF_STRING_TYPE_UTF8)
typedef CefStringUTF8 CefString;
#elif defined(CEF_STRING_TYPE_WIDE)
typedef CefStringWide CefString;
#endif

View File

@ -37,31 +37,47 @@
extern "C" {
#endif
///
// CEF string maps are a set of key/value string pairs.
///
typedef void* cef_string_list_t;
///
// Allocate a new string map.
///
CEF_EXPORT cef_string_list_t cef_string_list_alloc();
///
// Return the number of elements in the string list.
///
CEF_EXPORT int cef_string_list_size(cef_string_list_t list);
///
// Retrieve the value at the specified zero-based string list index. Returns
// true (1) if the value was successfully retrieved.
///
CEF_EXPORT int cef_string_list_value(cef_string_list_t list,
int index, cef_string_t* value);
///
// Append a new value at the end of the string list.
///
CEF_EXPORT void cef_string_list_append(cef_string_list_t list,
const cef_string_t* value);
///
// Clear the string list.
///
CEF_EXPORT void cef_string_list_clear(cef_string_list_t list);
///
// Free the string list.
///
CEF_EXPORT void cef_string_list_free(cef_string_list_t list);
///
// Creates a copy of an existing string list.
///
CEF_EXPORT cef_string_list_t cef_string_list_copy(cef_string_list_t list);
#ifdef __cplusplus

View File

@ -37,37 +37,55 @@
extern "C" {
#endif
///
// CEF string maps are a set of key/value string pairs.
///
typedef void* cef_string_map_t;
///
// Allocate a new string map.
///
CEF_EXPORT cef_string_map_t cef_string_map_alloc();
///
// Return the number of elements in the string map.
///
CEF_EXPORT int cef_string_map_size(cef_string_map_t map);
///
// Return the value assigned to the specified key.
///
CEF_EXPORT int cef_string_map_find(cef_string_map_t map,
const cef_string_t* key,
cef_string_t* value);
///
// Return the key at the specified zero-based string map index.
///
CEF_EXPORT int cef_string_map_key(cef_string_map_t map, int index,
cef_string_t* key);
///
// Return the value at the specified zero-based string map index.
///
CEF_EXPORT int cef_string_map_value(cef_string_map_t map, int index,
cef_string_t* value);
///
// Append a new key/value pair at the end of the string map.
///
CEF_EXPORT int cef_string_map_append(cef_string_map_t map,
const cef_string_t* key,
const cef_string_t* value);
///
// Clear the string map.
///
CEF_EXPORT void cef_string_map_clear(cef_string_map_t map);
///
// Free the string map.
///
CEF_EXPORT void cef_string_map_free(cef_string_map_t map);

View File

@ -82,9 +82,11 @@ typedef struct _cef_string_utf16_t {
} cef_string_utf16_t;
///
// These functions set string values. If |copy| is true (1) the value will be
// copied instead of referenced. It is up to the user to properly manage
// the lifespan of references.
///
CEF_EXPORT int cef_string_wide_set(const wchar_t* src, size_t src_len,
cef_string_wide_t* output, int copy);
@ -94,7 +96,9 @@ CEF_EXPORT int cef_string_utf16_set(const char16_t* src, size_t src_len,
cef_string_utf16_t* output, int copy);
///
// Convenience macros for copying values.
///
#define cef_string_wide_copy(src, src_len, output) \
cef_string_wide_set(src, src_len, output, true)
@ -104,14 +108,18 @@ CEF_EXPORT int cef_string_utf16_set(const char16_t* src, size_t src_len,
cef_string_utf16_set(src, src_len, output, true)
///
// These functions clear string values. The structure itself is not freed.
///
CEF_EXPORT void cef_string_wide_clear(cef_string_wide_t* str);
CEF_EXPORT void cef_string_utf8_clear(cef_string_utf8_t* str);
CEF_EXPORT void cef_string_utf16_clear(cef_string_utf16_t* str);
///
// These functions compare two string values with the same results as strcmp().
///
CEF_EXPORT int cef_string_wide_cmp(const cef_string_wide_t* str1,
const cef_string_wide_t* str2);
@ -121,10 +129,12 @@ CEF_EXPORT int cef_string_utf16_cmp(const cef_string_utf16_t* str1,
const cef_string_utf16_t* str2);
///
// These functions convert between UTF-8, -16, and -32 strings. They are
// potentially slow so unnecessary conversions should be avoided. The best
// possible result will always be written to |output| with the boolean return
// value indicating whether the conversion is 100% valid.
///
CEF_EXPORT int cef_string_wide_to_utf8(const wchar_t* src, size_t src_len,
cef_string_utf8_t* output);
@ -142,9 +152,11 @@ CEF_EXPORT int cef_string_utf16_to_utf8(const char16_t* src, size_t src_len,
cef_string_utf8_t* output);
///
// These functions convert an ASCII string, typically a hardcoded constant, to a
// Wide/UTF16 string. Use instead of the UTF8 conversion routines if you know
// the string is ASCII.
///
CEF_EXPORT int cef_string_ascii_to_wide(const char* src, size_t src_len,
cef_string_wide_t* output);
@ -153,25 +165,31 @@ CEF_EXPORT int cef_string_ascii_to_utf16(const char* src, size_t src_len,
///
// It is sometimes necessary for the system to allocate string structures with
// the expectation that the user will free them. The userfree types act as a
// hint that the user is responsible for freeing the structure.
///
typedef cef_string_wide_t* cef_string_userfree_wide_t;
typedef cef_string_utf8_t* cef_string_userfree_utf8_t;
typedef cef_string_utf16_t* cef_string_userfree_utf16_t;
///
// These functions allocate a new string structure. They must be freed by
// calling the associated free function.
///
CEF_EXPORT cef_string_userfree_wide_t cef_string_userfree_wide_alloc();
CEF_EXPORT cef_string_userfree_utf8_t cef_string_userfree_utf8_alloc();
CEF_EXPORT cef_string_userfree_utf16_t cef_string_userfree_utf16_alloc();
///
// These functions free the string structure allocated by the associated
// alloc function. Any string contents will first be cleared.
///
CEF_EXPORT void cef_string_userfree_wide_free(cef_string_userfree_wide_t str);
CEF_EXPORT void cef_string_userfree_utf8_free(cef_string_userfree_utf8_t str);

View File

@ -37,7 +37,9 @@
#include <memory.h>
#include <string>
///
// Traits implementation for wide character strings.
///
struct CefStringTraitsWide {
typedef wchar_t char_type;
typedef cef_string_wide_t struct_type;
@ -115,7 +117,9 @@ struct CefStringTraitsWide {
#endif // BUILDING_CEF_SHARED
};
///
// Traits implementation for utf8 character strings.
///
struct CefStringTraitsUTF8 {
typedef char char_type;
typedef cef_string_utf8_t struct_type;
@ -180,7 +184,9 @@ struct CefStringTraitsUTF8 {
#endif // BUILDING_CEF_SHARED
};
///
// Traits implementation for utf16 character strings.
///
struct CefStringTraitsUTF16 {
typedef char16_t char_type;
typedef cef_string_utf16_t struct_type;
@ -259,7 +265,34 @@ struct CefStringTraitsUTF16 {
#endif // BUILDING_CEF_SHARED
};
// String template.
///
// CEF string classes can convert between all supported string types. For
// example, the CefStringWide class uses wchar_t as the underlying character
// type and provides two approaches for converting data to/from a UTF8 string
// (std::string).
// <p>
// 1. Implicit conversion using the assignment operator overload.
// <pre>
// CefStringWide aCefString;
// std::string aUTF8String;
// aCefString = aUTF8String; // Assign std::string to CefStringWide
// aUTF8String = aCefString; // Assign CefStringWide to std::string
// </pre>
// 2. Explicit conversion using the FromString/ToString methods.
// <pre>
// CefStringWide aCefString;
// std::string aUTF8String;
// aCefString.FromString(aUTF8String); // Assign std::string to CefStringWide
// aUTF8String = aCefString.ToString(); // Assign CefStringWide to std::string
// </pre>
// Conversion will only occur if the assigned value is a different string type.
// Assigning a std::string to a CefStringUTF8, for example, will copy the data
// without performing a conversion.
// </p>
// CEF string classes are safe for reading from multiple threads but not for
// modification. It is the user's responsibility to provide synchronization if
// modifying CEF strings from multiple threads.
///
template <class traits>
class CefStringBase {
public:
@ -267,50 +300,64 @@ public:
typedef typename traits::struct_type struct_type;
typedef typename traits::userfree_struct_type userfree_struct_type;
///
// Default constructor.
///
CefStringBase() : string_(NULL), owner_(false) {}
///
// Create a new string from an existing string. Data will always be copied.
///
CefStringBase(const CefStringBase& str) : string_(NULL), owner_(false)
{ FromString(str.c_str(), str.length(), true); }
///
// Create a new string from an existing std::string. Data will be always
// copied. Translation will occur if necessary based on the underlying string
// type.
///
CefStringBase(const std::string& src) : string_(NULL), owner_(false)
{ FromString(src); }
CefStringBase(const char* src) : string_(NULL), owner_(false)
{ FromString(std::string(src)); }
///
// Create a new string from an existing std::wstring. Data will be always
// copied. Translation will occur if necessary based on the underlying string
// type.
///
CefStringBase(const std::wstring& src) : string_(NULL), owner_(false)
{ FromWString(src); }
CefStringBase(const wchar_t* src) : string_(NULL), owner_(false)
{ FromWString(std::wstring(src)); }
#if (defined(BUILDING_CEF_SHARED) && defined(WCHAR_T_IS_UTF32))
///
// Create a new string from an existing string16. Data will be always
// copied. Translation will occur if necessary based on the underlying string
// type.
///
CefStringBase(const string16& src) : string_(NULL), owner_(false)
{ FromString16(src); }
CefStringBase(const char16_t* src) : string_(NULL), owner_(false)
{ FromString16(string16(src)); }
#endif // BUILDING_CEF_SHARED && WCHAR_T_IS_UTF32
///
// Create a new string from an existing character array. If |copy| is true
// this class will copy the data. Otherwise, this class will reference the
// existing data. Referenced data must exist for the lifetime of this class
// and will not be freed by this class.
///
CefStringBase(const char_type* src, size_t src_len, bool copy)
: string_(NULL), owner_(false)
{ FromString(src, src_len, copy); }
///
// Create a new string referencing an existing string structure without taking
// ownership. Referenced structures must exist for the lifetime of this class
// and will not be freed by this class.
///
CefStringBase(const struct_type* src) : string_(NULL), owner_(false)
{
if (!src)
@ -325,19 +372,29 @@ public:
// The following methods are named for compatibility with the standard library
// string template types.
///
// Return a read-only pointer to the string data.
///
const char_type* c_str() const { return (string_ ? string_->str : NULL); }
///
// Return the length of the string data.
///
size_t length() const { return (string_ ? string_->length : 0); }
///
// Return the length of the string data.
///
inline size_t size() const { return length(); }
///
// Returns true if the string is empty.
///
bool empty() const { return (string_ == NULL || string_->length == 0); }
///
// Compare this string to the specified string.
///
int compare(const CefStringBase& str) const
{
if (empty() && str.empty())
@ -349,7 +406,9 @@ public:
return traits::compare(string_, str.GetStruct());
}
///
// Clear the string data.
///
void clear()
{
if (!empty())
@ -359,23 +418,31 @@ public:
// The following methods are unique to CEF string template types.
///
// Returns true if this class owns the underlying string structure.
///
bool IsOwner() const { return owner_; }
///
// Returns a read-only pointer to the underlying string structure. May return
// NULL if no structure is currently allocated.
///
const struct_type* GetStruct() const { return string_; }
///
// Returns a writable pointer to the underlying string structure. Will never
// return NULL.
///
struct_type* GetWritableStruct()
{
AllocIfNeeded();
return string_;
}
///
// Clear the state of this class. The underlying string structure and data
// will be freed if this class owns the structure.
///
void ClearAndFree()
{
if (!string_)
@ -388,8 +455,10 @@ public:
owner_ = false;
}
///
// Attach to the specified string structure. If |owner| is true this class
// will take ownership of the structure.
///
void Attach(struct_type* str, bool owner)
{
// Free the previous structure and data, if any.
@ -399,9 +468,11 @@ public:
owner_ = owner;
}
///
// Take ownership of the specified userfree structure's string data. The
// userfree structure itself will be freed. Only use this method with userfree
// structures.
///
void AttachToUserFree(userfree_struct_type str)
{
// Free the previous structure and data, if any.
@ -419,18 +490,22 @@ public:
traits::userfree_free(str);
}
///
// Detach from the underlying string structure. To avoid memory leaks only use
// this method if you already hold a pointer to the underlying string
// structure.
///
void Detach()
{
string_ = NULL;
owner_ = false;
}
///
// Create a userfree structure and give it ownership of this class' string
// data. This class will be disassociated from the data. May return NULL if
// this string class currently contains no data.
///
userfree_struct_type DetachToUserFree()
{
if (empty())
@ -446,10 +521,12 @@ public:
return str;
}
///
// Set this string's data to the specified character array. If |copy| is true
// this class will copy the data. Otherwise, this class will reference the
// existing data. Referenced data must exist for the lifetime of this class
// and will not be freed by this class.
///
bool FromString(const char_type* src, size_t src_len, bool copy)
{
if (src == NULL || src_len == 0) {
@ -460,9 +537,11 @@ public:
return traits::set(src, src_len, string_, copy) ? true : false;
}
///
// Set this string's data from an existing ASCII string. Data will be always
// copied. Translation will occur if necessary based on the underlying string
// type.
///
bool FromASCII(const char* str)
{
size_t len = str ? strlen(str) : 0;
@ -474,8 +553,10 @@ public:
return traits::from_ascii(str, len, string_);
}
///
// Return this string's data as a std::string. Translation will occur if
// necessary based on the underlying string type.
///
std::string ToString() const
{
if (empty())
@ -483,9 +564,11 @@ public:
return traits::to_string(string_);
}
///
// Set this string's data from an existing std::string. Data will be always
// copied. Translation will occur if necessary based on the underlying string
// type.
///
bool FromString(const std::string& str)
{
if (str.empty()) {
@ -496,8 +579,10 @@ public:
return traits::from_string(str, string_);
}
///
// Return this string's data as a std::wstring. Translation will occur if
// necessary based on the underlying string type.
///
std::wstring ToWString() const
{
if (empty())
@ -505,9 +590,11 @@ public:
return traits::to_wstring(string_);
}
///
// Set this string's data from an existing std::wstring. Data will be always
// copied. Translation will occur if necessary based on the underlying string
// type.
///
bool FromWString(const std::wstring& str)
{
if (str.empty()) {
@ -518,8 +605,10 @@ public:
return traits::from_wstring(str, string_);
}
#if defined(BUILDING_CEF_SHARED)
///
// Return this string's data as a string16. Translation will occur if
// necessary based on the underlying string type.
///
string16 ToString16() const
{
if (empty())
@ -527,9 +616,11 @@ public:
return traits::to_string16(string_);
}
///
// Set this string's data from an existing string16. Data will be always
// copied. Translation will occur if necessary based on the underlying string
// type.
///
bool FromString16(const string16& str)
{
if (str.empty()) {
@ -541,7 +632,9 @@ public:
}
#endif // BUILDING_CEF_SHARED
///
// Comparison operator overloads.
///
bool operator<(const CefStringBase& str) const
{ return (compare(str) < 0); }
bool operator<=(const CefStringBase& str) const
@ -555,7 +648,9 @@ public:
bool operator!=(const CefStringBase& str) const
{ return (compare(str) != 0); }
///
// Assignment operator overloads.
///
CefStringBase& operator=(const CefStringBase& str)
{ FromString(str.c_str(), str.length(), true); return *this; }
operator std::string() const { return ToString(); }
@ -592,33 +687,6 @@ private:
};
// CEF string classes can convert between all supported string types. For
// example, the CefStringWide class uses wchar_t as the underlying character
// type and provides two approaches for converting data to/from a UTF8 string
// (std::string).
//
// 1. Implicit conversion using the assignment operator overload.
//
// CefStringWide aCefString;
// std::string aUTF8String;
// aCefString = aUTF8String; // Assign std::string to CefStringWide
// aUTF8String = aCefString; // Assign CefStringWide to std::string
//
// 2. Explicit conversion using the FromString/ToString methods.
//
// CefStringWide aCefString;
// std::string aUTF8String;
// aCefString.FromString(aUTF8String); // Assign std::string to CefStringWide
// aUTF8String = aCefString.ToString(); // Assign CefStringWide to std::string
//
// Conversion will only occur if the assigned value is a different string type.
// Assigning a std::string to a CefStringUTF8, for example, will copy the data
// without performing a conversion.
//
// CEF string classes are safe for reading from multiple threads but not for
// modification. It is the user's responsibility to provide synchronization if
// modifying CEF strings from multiple threads.
typedef CefStringBase<CefStringTraitsWide> CefStringWide;
typedef CefStringBase<CefStringTraitsUTF8> CefStringUTF8;
typedef CefStringBase<CefStringTraitsUTF16> CefStringUTF16;

View File

@ -37,7 +37,9 @@ extern "C" {
#include "cef_export.h"
#include <time.h>
///
// Time information. Values should always be in UTC.
///
typedef struct _cef_time_t
{
int year; // Four digit year "2007"
@ -51,15 +53,19 @@ typedef struct _cef_time_t
int millisecond; // Milliseconds within the current second (0-999)
} cef_time_t;
///
// Converts cef_time_t to/from time_t. Returns true (1) on success and false (0)
// on failure.
///
CEF_EXPORT int cef_time_to_timet(const cef_time_t* cef_time, time_t* time);
CEF_EXPORT int cef_time_from_timet(time_t time, cef_time_t* cef_time);
///
// Converts cef_time_t to/from a double which is the number of seconds since
// epoch (Jan 1, 1970). Webkit uses this format to represent time. A value of 0
// means "not initialized". Returns true (1) on success and false (0) on
// failure.
///
CEF_EXPORT int cef_time_to_doublet(const cef_time_t* cef_time, double* time);
CEF_EXPORT int cef_time_from_doublet(double time, cef_time_t* cef_time);

View File

@ -59,7 +59,9 @@ typedef unsigned long long uint64;
extern "C" {
#endif
///
// Log severity levels.
///
enum cef_log_severity_t
{
LOGSEVERITY_VERBOSE = -1,
@ -71,64 +73,92 @@ enum cef_log_severity_t
LOGSEVERITY_DISABLE = 99
};
///
// Initialization settings. Specify NULL or 0 to get the recommended default
// values.
///
typedef struct _cef_settings_t
{
///
// Size of this structure.
///
size_t size;
///
// Set to true (1) to have the message loop run in a separate thread. If
// false (0) than the CefDoMessageLoopWork() function must be called from
// your application message loop.
///
bool multi_threaded_message_loop;
///
// The location where cache data will be stored on disk. If empty an
// in-memory cache will be used. HTML5 databases such as localStorage will
// only persist across sessions if a cache path is specified.
///
cef_string_t cache_path;
///
// Value that will be returned as the User-Agent HTTP header. If empty the
// default User-Agent string will be used.
///
cef_string_t user_agent;
///
// Value that will be inserted as the product portion of the default
// User-Agent string. If empty the Chromium product version will be used. If
// |userAgent| is specified this value will be ignored.
///
cef_string_t product_version;
///
// The locale string that will be passed to WebKit. If empty the default
// locale of "en-US" will be used.
///
cef_string_t locale;
///
// List of fully qualified paths to plugins (including plugin name) that will
// be loaded in addition to any plugins found in the default search paths.
///
cef_string_list_t extra_plugin_paths;
///
// The directory and file name to use for the debug log. If empty, the
// default name of "debug.log" will be used and the file will be written
// to the application directory.
///
cef_string_t log_file;
///
// The log severity. Only messages of this severity level or higher will be
// logged.
///
cef_log_severity_t log_severity;
} cef_settings_t;
///
// Browser initialization settings. Specify NULL or 0 to get the recommended
// default values. The consequences of using custom values may not be well
// tested.
///
typedef struct _cef_browser_settings_t
{
///
// Size of this structure.
///
size_t size;
///
// Disable drag & drop of URLs from other windows.
///
bool drag_drop_disabled;
// The below values map to WebPreferences settings.
///
// Font settings.
///
cef_string_t standard_font_family;
cef_string_t fixed_font_family;
cef_string_t serif_font_family;
@ -140,176 +170,280 @@ typedef struct _cef_browser_settings_t
int minimum_font_size;
int minimum_logical_font_size;
///
// Set to true (1) to disable loading of fonts from remote sources.
///
bool remote_fonts_disabled;
///
// Default encoding for Web content. If empty "ISO-8859-1" will be used.
///
cef_string_t default_encoding;
///
// Set to true (1) to attempt automatic detection of content encoding.
///
bool encoding_detector_enabled;
///
// Set to true (1) to disable JavaScript.
///
bool javascript_disabled;
///
// Set to true (1) to disallow JavaScript from opening windows.
///
bool javascript_open_windows_disallowed;
///
// Set to true (1) to disallow JavaScript from closing windows.
///
bool javascript_close_windows_disallowed;
///
// Set to true (1) to disallow JavaScript from accessing the clipboard.
///
bool javascript_access_clipboard_disallowed;
///
// Set to true (1) to disable DOM pasting in the editor. DOM pasting also
// depends on |javascript_cannot_access_clipboard| being false (0).
///
bool dom_paste_disabled;
///
// Set to true (1) to enable drawing of the caret position.
///
bool caret_browsing_enabled;
///
// Set to true (1) to disable Java.
///
bool java_disabled;
///
// Set to true (1) to disable plugins.
///
bool plugins_disabled;
///
// Set to true (1) to allow access to all URLs from file URLs.
///
bool universal_access_from_file_urls_allowed;
///
// Set to true (1) to allow access to file URLs from other file URLs.
///
bool file_access_from_file_urls_allowed;
///
// Set to true (1) to allow risky security behavior such as cross-site
// scripting (XSS). Use with extreme care.
///
bool web_security_disabled;
///
// Set to true (1) to enable console warnings about XSS attempts.
///
bool xss_auditor_enabled;
///
// Set to true (1) to suppress the network load of image URLs. A cached
// image will still be rendered if requested.
///
bool image_load_disabled;
///
// Set to true (1) to shrink standalone images to fit the page.
///
bool shrink_standalone_images_to_fit;
///
// Set to true (1) to disable browser backwards compatibility features.
///
bool site_specific_quirks_disabled;
///
// Set to true (1) to disable resize of text areas.
///
bool text_area_resize_disabled;
///
// Set to true (1) to disable use of the page cache.
///
bool page_cache_disabled;
///
// Set to true (1) to not have the tab key advance focus to links.
///
bool tab_to_links_disabled;
///
// Set to true (1) to disable hyperlink pings (<a ping> and window.sendPing).
///
bool hyperlink_auditing_disabled;
///
// Set to true (1) to enable the user style sheet for all pages.
// |user_style_sheet_location| must be set to the style sheet URL.
///
bool user_style_sheet_enabled;
cef_string_t user_style_sheet_location;
///
// Set to true (1) to disable style sheets.
///
bool author_and_user_styles_disabled;
///
// Set to true (1) to disable local storage.
///
bool local_storage_disabled;
///
// Set to true (1) to disable databases.
///
bool databases_disabled;
///
// Set to true (1) to disable application cache.
///
bool application_cache_disabled;
///
// Set to true (1) to disable WebGL.
///
bool webgl_disabled;
///
// Set to true (1) to disable accelerated compositing.
///
bool accelerated_compositing_disabled;
///
// Set to true (1) to disable accelerated layers. This affects features like
// 3D CSS transforms.
///
bool accelerated_layers_disabled;
///
// Set to true (1) to disable accelerated 2d canvas.
///
bool accelerated_2d_canvas_disabled;
///
// Set to true (1) to disable developer tools (WebKit inspector).
///
bool developer_tools_disabled;
} cef_browser_settings_t;
///
// URL component parts.
///
typedef struct _cef_urlparts_t
{
///
// The complete URL specification.
///
cef_string_t spec;
///
// Scheme component not including the colon (e.g., "http").
///
cef_string_t scheme;
///
// User name component.
///
cef_string_t username;
///
// Password component.
///
cef_string_t password;
///
// Host component. This may be a hostname, an IPv4 address or an IPv6 literal
// surrounded by square brackets (e.g., "[2001:db8::1]").
///
cef_string_t host;
///
// Port number component.
///
cef_string_t port;
///
// Path component including the first slash following the host.
///
cef_string_t path;
///
// Query string component (i.e., everything following the '?').
///
cef_string_t query;
} cef_urlparts_t;
///
// Cookie information.
///
typedef struct _cef_cookie_t
{
///
// The cookie name.
///
cef_string_t name;
///
// The cookie value.
///
cef_string_t value;
///
// If |domain| is empty a host cookie will be created instead of a domain
// cookie. Domain cookies are stored with a leading "." and are visible to
// sub-domains whereas host cookies are not.
///
cef_string_t domain;
///
// If |path| is non-empty only URLs at or below the path will get the cookie
// value.
///
cef_string_t path;
///
// If |secure| is true the cookie will only be sent for HTTPS requests.
///
bool secure;
///
// If |httponly| is true the cookie will only be sent for HTTP requests.
///
bool httponly;
///
// The cookie creation date. This is automatically populated by the system on
// cookie creation.
///
cef_time_t creation;
///
// The cookie last access date. This is automatically populated by the system
// on access.
///
cef_time_t last_access;
///
// The cookie expiration date is only valid if |has_expires| is true.
///
bool has_expires;
cef_time_t expires;
} cef_cookie_t;
///
// Mouse button types.
///
enum cef_mouse_button_type_t
{
MBT_LEFT = 0,
@ -317,7 +451,9 @@ enum cef_mouse_button_type_t
MBT_RIGHT,
};
///
// Key types.
///
enum cef_key_type_t
{
KT_KEYUP = 0,
@ -325,7 +461,9 @@ enum cef_key_type_t
KT_CHAR,
};
///
// Various browser navigation types supported by chrome.
///
enum cef_handler_navtype_t
{
NAVTYPE_LINKCLICKED = 0,
@ -336,8 +474,10 @@ enum cef_handler_navtype_t
NAVTYPE_OTHER,
};
///
// Supported error code values. See net\base\net_error_list.h for complete
// descriptions of the error codes.
///
enum cef_handler_errorcode_t
{
ERR_FAILED = -2,
@ -390,7 +530,9 @@ enum cef_handler_errorcode_t
ERR_INSECURE_RESPONSE = -501,
};
///
// V8 access control values.
///
enum cef_v8_accesscontrol_t
{
V8_ACCESS_CONTROL_DEFAULT = 0,
@ -399,7 +541,9 @@ enum cef_v8_accesscontrol_t
V8_ACCESS_CONTROL_PROHIBITS_OVERWRITING = 1 << 2
};
///
// V8 property attribute values.
///
enum cef_v8_propertyattribute_t
{
V8_PROPERTY_ATTRIBUTE_NONE = 0, // Writeable, Enumerable,
@ -409,14 +553,20 @@ enum cef_v8_propertyattribute_t
V8_PROPERTY_ATTRIBUTE_DONTDELETE = 1 << 2 // Not configurable
};
///
// Structure representing menu information.
///
typedef struct _cef_handler_menuinfo_t
{
///
// Values from the cef_handler_menutypebits_t enumeration.
///
int typeFlags;
///
// If window rendering is enabled |x| and |y| will be in screen coordinates.
// Otherwise, |x| and |y| will be in view coordinates.
///
int x;
int y;
@ -427,40 +577,66 @@ typedef struct _cef_handler_menuinfo_t
cef_string_t selectionText;
cef_string_t misspelledWord;
///
// Values from the cef_handler_menucapabilitybits_t enumeration.
///
int editFlags;
cef_string_t securityInfo;
} cef_handler_menuinfo_t;
///
// The cef_handler_menuinfo_t typeFlags value will be a combination of the
// following values.
///
enum cef_handler_menutypebits_t
{
///
// No node is selected
///
MENUTYPE_NONE = 0x0,
///
// The top page is selected
///
MENUTYPE_PAGE = 0x1,
///
// A subframe page is selected
///
MENUTYPE_FRAME = 0x2,
///
// A link is selected
///
MENUTYPE_LINK = 0x4,
///
// An image is selected
///
MENUTYPE_IMAGE = 0x8,
///
// There is a textual or mixed selection that is selected
///
MENUTYPE_SELECTION = 0x10,
///
// An editable element is selected
///
MENUTYPE_EDITABLE = 0x20,
///
// A misspelled word is selected
///
MENUTYPE_MISSPELLED_WORD = 0x40,
///
// A video node is selected
///
MENUTYPE_VIDEO = 0x80,
///
// A video node is selected
///
MENUTYPE_AUDIO = 0x100,
};
///
// The cef_handler_menuinfo_t editFlags value will be a combination of the
// following values.
///
enum cef_handler_menucapabilitybits_t
{
// Values from WebContextMenuData::EditFlags in WebContextMenuData.h
@ -478,7 +654,9 @@ enum cef_handler_menucapabilitybits_t
MENU_CAN_GO_BACK = 0x20000000,
};
///
// Supported menu ID values.
///
enum cef_handler_menuid_t
{
MENU_ID_NAV_BACK = 10,
@ -503,7 +681,9 @@ enum cef_paint_element_type_t
PET_POPUP,
};
///
// Post data elements may represent either bytes or files.
///
enum cef_postdataelement_type_t
{
PDE_TYPE_EMPTY = 0,
@ -533,7 +713,9 @@ enum cef_weburlrequest_state_t
WUR_STATE_ABORT = 6,
};
///
// Key event types.
///
enum cef_handler_keyevent_type_t
{
KEYEVENT_RAWKEYDOWN = 0,
@ -542,7 +724,9 @@ enum cef_handler_keyevent_type_t
KEYEVENT_CHAR
};
///
// Key event modifiers.
///
enum cef_handler_keyevent_modifiers_t
{
KEY_SHIFT = 1 << 0,
@ -551,7 +735,9 @@ enum cef_handler_keyevent_modifiers_t
KEY_META = 1 << 3
};
///
// Structure representing a rectangle.
///
typedef struct _cef_rect_t
{
int x;
@ -560,7 +746,9 @@ typedef struct _cef_rect_t
int height;
} cef_rect_t;
///
// Existing thread IDs.
///
enum cef_thread_id_t
{
TID_UI = 0,
@ -568,7 +756,9 @@ enum cef_thread_id_t
TID_FILE = 2,
};
///
// Paper type for printing.
///
enum cef_paper_type_t
{
PT_LETTER = 0,
@ -579,7 +769,9 @@ enum cef_paper_type_t
PT_CUSTOM
};
///
// Paper metric information for printing.
///
struct cef_paper_metrics
{
enum cef_paper_type_t paper_type;
@ -589,7 +781,9 @@ struct cef_paper_metrics
double width;
};
///
// Paper print margins.
///
struct cef_print_margins
{
//Margin size in inches for left/right/top/bottom (this is content margins).
@ -602,14 +796,18 @@ struct cef_print_margins
double footer;
};
///
// Page orientation for printing.
///
enum cef_page_orientation
{
PORTRAIT = 0,
LANDSCAPE
};
///
// Printing options.
///
typedef struct _cef_print_options_t
{
enum cef_page_orientation page_orientation;
@ -617,10 +815,12 @@ typedef struct _cef_print_options_t
struct cef_print_margins paper_margins;
} cef_print_options_t;
///
// Supported XML encoding types. The parser supports ASCII, ISO-8859-1, and
// UTF16 (LE and BE) by default. All other types must be translated to UTF8
// before being passed to the parser. If a BOM is detected and the correct
// decoder is available then that decoder will be used automatically.
///
enum cef_xml_encoding_type_t
{
XML_ENCODING_NONE = 0,
@ -630,7 +830,9 @@ enum cef_xml_encoding_type_t
XML_ENCODING_ASCII,
};
///
// XML node types.
///
enum cef_xml_node_type_t
{
XML_NODE_UNSUPPORTED = 0,
@ -646,7 +848,9 @@ enum cef_xml_node_type_t
XML_NODE_COMMENT,
};
///
// Status message types.
///
enum cef_handler_statustype_t
{
STATUSTYPE_TEXT = 0,
@ -654,7 +858,9 @@ enum cef_handler_statustype_t
STATUSTYPE_KEYBOARD_FOCUS_URL,
};
///
// Popup window features.
///
typedef struct _cef_popup_features_t
{
int x;
@ -678,7 +884,9 @@ typedef struct _cef_popup_features_t
cef_string_list_t additionalFeatures;
} cef_popup_features_t;
///
// DOM document types.
///
enum cef_dom_document_type_t
{
DOM_DOCUMENT_TYPE_UNKNOWN = 0,
@ -687,7 +895,9 @@ enum cef_dom_document_type_t
DOM_DOCUMENT_TYPE_PLUGIN,
};
///
// DOM event category flags.
///
enum cef_dom_event_category_t
{
DOM_EVENT_CATEGORY_UNKNOWN = 0x0,
@ -712,7 +922,9 @@ enum cef_dom_event_category_t
DOM_EVENT_CATEGORY_BEFORE_LOAD = 0x40000,
};
///
// DOM event processing phases.
///
enum cef_dom_event_phase_t
{
DOM_EVENT_PHASE_UNKNOWN = 0,
@ -721,7 +933,9 @@ enum cef_dom_event_phase_t
DOM_EVENT_PHASE_BUBBLING,
};
///
// DOM node types.
///
enum cef_dom_node_type_t
{
DOM_NODE_TYPE_UNSUPPORTED = 0,

View File

@ -43,7 +43,9 @@ extern "C" {
#define cef_window_handle_t GtkWidget*
#define cef_cursor_handle_t void*
///
// Class representing window information.
///
typedef struct _cef_window_info_t
{
// Pointer for the parent GtkBox widget.
@ -53,7 +55,9 @@ typedef struct _cef_window_info_t
cef_window_handle_t m_Widget;
} cef_window_info_t;
///
// Class representing print context information.
///
typedef struct _cef_print_info_t
{
double m_Scale;

View File

@ -51,7 +51,9 @@ class NSView;
extern "C" {
#endif
///
// Class representing window information.
///
typedef struct _cef_window_info_t
{
cef_string_t m_windowName;
@ -68,7 +70,9 @@ typedef struct _cef_window_info_t
cef_window_handle_t m_View;
} cef_window_info_t;
///
// Class representing print context information.
///
typedef struct _cef_print_info_t
{
double m_Scale;

View File

@ -43,7 +43,9 @@ extern "C" {
#define cef_window_handle_t HWND
#define cef_cursor_handle_t HCURSOR
///
// Class representing window information.
///
typedef struct _cef_window_info_t
{
// Standard parameters required by CreateWindowEx()
@ -66,7 +68,9 @@ typedef struct _cef_window_info_t
cef_window_handle_t m_hWnd;
} cef_window_info_t;
///
// Class representing print context information.
///
typedef struct _cef_print_info_t
{
HDC m_hDC;

View File

@ -34,7 +34,9 @@
#include "cef_string_list.h"
#include "cef_types.h"
///
// Template class that provides common functionality for CEF structure wrapping.
///
template <class traits>
class CefStructBase : public traits::struct_type {
public:
@ -63,15 +65,19 @@ public:
*this = r;
}
///
// Clear this object's values.
///
void Reset()
{
Clear(this);
Init();
}
///
// Attach to the source structure's existing values. DetachTo() can be called
// to insert the values back into the existing structure.
///
void AttachTo(struct_type& source)
{
// Only clear this object's data if it isn't currently attached to a
@ -86,7 +92,9 @@ public:
memcpy(static_cast<struct_type*>(this), &source, sizeof(struct_type));
}
///
// Relinquish ownership of values to the target structure.
///
void DetachTo(struct_type& target)
{
if (attached_to_ != &target) {
@ -102,8 +110,10 @@ public:
Init();
}
///
// Set this object's values. If |copy| is true the source structure's values
// will be copied instead of referenced.
///
void Set(const struct_type& source, bool copy)
{
traits::set(&source, this, copy);
@ -146,7 +156,9 @@ struct CefRectTraits {
}
};
///
// Class representing a rectangle.
///
class CefRect : public CefStructBase<CefRectTraits>
{
public:
@ -223,7 +235,9 @@ struct CefPopupFeaturesTraits {
}
};
///
// Class representing popup window features.
///
typedef CefStructBase<CefPopupFeaturesTraits> CefPopupFeatures;
@ -269,7 +283,9 @@ struct CefSettingsTraits {
}
};
///
// Class representing initialization settings.
///
typedef CefStructBase<CefSettingsTraits> CefSettings;
@ -367,7 +383,9 @@ struct CefBrowserSettingsTraits {
}
};
///
// Class representing browser initialization settings.
///
typedef CefStructBase<CefBrowserSettingsTraits> CefBrowserSettings;
@ -403,7 +421,9 @@ struct CefURLPartsTraits {
}
};
///
// Class representing a URL's component parts.
///
typedef CefStructBase<CefURLPartsTraits> CefURLParts;
@ -420,7 +440,9 @@ struct CefTimeTraits {
}
};
///
// Class representing a time.
///
class CefTime : public CefStructBase<CefTimeTraits>
{
public:
@ -483,7 +505,9 @@ struct CefCookieTraits {
}
};
///
// Class representing a cookie.
///
typedef CefStructBase<CefCookieTraits> CefCookie;
#endif // _CEF_TYPES_WRAPPERS_H

View File

@ -36,11 +36,15 @@
#include "cef_types_win.h"
#include "cef_types_wrappers.h"
///
// Atomic increment and decrement.
///
#define CefAtomicIncrement(p) InterlockedIncrement(p)
#define CefAtomicDecrement(p) InterlockedDecrement(p)
///
// Critical section wrapper.
///
class CefCriticalSection
{
public:
@ -65,7 +69,9 @@ public:
CRITICAL_SECTION m_sec;
};
///
// Handle types.
///
#define CefWindowHandle cef_window_handle_t
#define CefCursorHandle cef_cursor_handle_t
@ -97,7 +103,9 @@ struct CefWindowInfoTraits {
}
};
///
// Class representing window information.
///
class CefWindowInfo : public CefStructBase<CefWindowInfoTraits>
{
public:
@ -153,7 +161,9 @@ struct CefPrintInfoTraits {
}
};
///
// Class representing print context information.
///
typedef CefStructBase<CefPrintInfoTraits> CefPrintInfo;
#endif // OS_WIN

View File

@ -189,7 +189,8 @@ def get_comment(body, name):
elif line[0:2] == '/*':
continue
elif line[0:2] == '//':
result.append(line[3:])
# keep the comment line including any leading spaces
result.append(line[2:])
else:
break
@ -202,7 +203,15 @@ def format_comment(comment, indent, translate_map = None, maxchars = 80):
wrapme = ''
hasemptyline = False
for line in comment:
if line is None or len(line) == 0 or line[0:1] == ' ':
# if the line starts with a leading space, remove that space
if not line is None and len(line) > 0 and line[0:1] == ' ':
line = line[1:]
didremovespace = True
else:
didremovespace = False
if line is None or len(line) == 0 or line[0:1] == ' ' \
or line[0:1] == '/':
# the previous paragraph, if any, has ended
if len(wrapme) > 0:
if not translate_map is None:
@ -214,12 +223,15 @@ def format_comment(comment, indent, translate_map = None, maxchars = 80):
wrapme = ''
if not line is None:
if len(line) == 0 or line[0:1] == ' ':
if len(line) == 0 or line[0:1] == ' ' or line[0:1] == '/':
# blank lines or anything that's further indented should be
# output as-is
result += indent+'//'
if len(line) > 0:
result += ' '+line
if didremovespace:
result += ' '+line
else:
result += line;
result += '\n'
else:
# add to the current paragraph