mirror of https://github.com/vitalif/grive2
removed old Json code
parent
b2d0bf2ba8
commit
4da9d0bc00
|
@ -32,12 +32,6 @@
|
|||
|
||||
namespace gr {
|
||||
|
||||
Collection::Collection( const Json& entry ) :
|
||||
m_entry ( entry ),
|
||||
m_parent ( 0 )
|
||||
{
|
||||
}
|
||||
|
||||
Collection::Collection( const xml::Node& entry ) :
|
||||
m_entry ( entry ),
|
||||
m_parent ( 0 )
|
||||
|
@ -51,13 +45,6 @@ Collection::Collection(
|
|||
{
|
||||
}
|
||||
|
||||
std::string Collection::ParentHref( const Json& entry )
|
||||
{
|
||||
Json node ;
|
||||
return entry["link"].FindInArray( "rel", "http://schemas.google.com/docs/2007#parent", node ) ?
|
||||
node["href"].As<std::string>() : std::string() ;
|
||||
}
|
||||
|
||||
std::string Collection::Href() const
|
||||
{
|
||||
return m_entry.SelfHref() ;
|
||||
|
|
|
@ -33,7 +33,6 @@ class Path ;
|
|||
class Collection
|
||||
{
|
||||
public :
|
||||
explicit Collection( const Json& entry ) ;
|
||||
explicit Collection( const xml::Node& entry ) ;
|
||||
Collection( const std::string& title, const std::string& href ) ;
|
||||
|
||||
|
@ -41,7 +40,6 @@ public :
|
|||
|
||||
static bool IsCollection( const Json& entry ) ;
|
||||
static bool IsCollection( const xml::Node& entry ) ;
|
||||
static std::string ParentHref( const Json& entry ) ;
|
||||
|
||||
std::string Title() const ;
|
||||
std::string Href() const ;
|
||||
|
|
|
@ -25,8 +25,6 @@
|
|||
#include "http/Agent.hh"
|
||||
#include "http/ResponseLog.hh"
|
||||
#include "http/XmlResponse.hh"
|
||||
#include "protocol/Json.hh"
|
||||
#include "protocol/JsonResponse.hh"
|
||||
#include "protocol/OAuth2.hh"
|
||||
#include "util/Crypt.hh"
|
||||
#include "util/DateTime.hh"
|
||||
|
@ -121,10 +119,6 @@ void Drive::ConstructDirTree( http::Agent *http )
|
|||
|
||||
http->Get( root_url + "/-/folder?max-results=10", &log, m_http_hdr ) ;
|
||||
|
||||
// http::JsonResponse jrsp ;
|
||||
// http->Get( root_url + "/-/folder?alt=json", &jrsp, m_http_hdr ) ;
|
||||
// Json resp = jrsp.Response() ;
|
||||
|
||||
xml::Node resp = xml.Response() ;
|
||||
|
||||
assert( m_coll.empty() ) ;
|
||||
|
@ -140,9 +134,6 @@ void Drive::ConstructDirTree( http::Agent *http )
|
|||
m_coll.push_back( Collection( *i ) ) ;
|
||||
}
|
||||
|
||||
// Json next ;
|
||||
// if ( !resp["feed"]["link"].FindInArray( "rel", "next", next ) )
|
||||
// break ;
|
||||
xml::NodeSet next = resp["link"].Find( "@rel", "next" ) ;
|
||||
if ( next.empty() )
|
||||
break ;
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
#include "http/Download.hh"
|
||||
#include "http/StringResponse.hh"
|
||||
#include "http/XmlResponse.hh"
|
||||
#include "protocol/Json.hh"
|
||||
#include "protocol/OAuth2.hh"
|
||||
#include "util/OS.hh"
|
||||
#include "util/Path.hh"
|
||||
|
@ -42,11 +41,6 @@ Entry::Entry( const Path& file )
|
|||
{
|
||||
}
|
||||
|
||||
Entry::Entry( const Json& entry )
|
||||
{
|
||||
Update( entry ) ;
|
||||
}
|
||||
|
||||
Entry::Entry( const xml::Node& n )
|
||||
{
|
||||
Update( n ) ;
|
||||
|
@ -58,41 +52,6 @@ Entry::Entry( const std::string& title, const std::string& href ) :
|
|||
{
|
||||
}
|
||||
|
||||
void Entry::Update( const Json& entry )
|
||||
{
|
||||
m_title = entry["title"]["$t"].Str() ;
|
||||
|
||||
m_filename = entry.Has("docs$suggestedFilename") ?
|
||||
entry["docs$suggestedFilename"]["$t"].Str() : "" ;
|
||||
|
||||
m_content_src = entry["content"]["src"].Str() ;
|
||||
m_self_href = entry["link"].FindInArray( "rel", "self" )["href"].Str() ;
|
||||
m_parent_href = Parent( entry ) ;
|
||||
m_server_modified = DateTime( entry["updated"]["$t"].Str() ) ;
|
||||
m_etag = entry["gd$etag"].Str() ;
|
||||
|
||||
m_resource_id = entry["gd$resourceId"]["$t"].Str() ;
|
||||
|
||||
m_server_md5 = entry.Has("docs$md5Checksum") ?
|
||||
entry["docs$md5Checksum"]["$t"].Str() : "" ;
|
||||
|
||||
Json node ;
|
||||
m_kind = entry["category"].
|
||||
FindInArray( "scheme", "http://schemas.google.com/g/2005#kind", node )
|
||||
? node["label"].Str() : std::string() ;
|
||||
|
||||
m_upload_link = entry["link"].
|
||||
FindInArray( "rel", "http://schemas.google.com/g/2005#resumable-edit-media", node )
|
||||
? node["href"].Str() : std::string() ;
|
||||
|
||||
// convert to lower case for easy comparison
|
||||
std::transform(
|
||||
m_server_md5.begin(),
|
||||
m_server_md5.end(),
|
||||
m_server_md5.begin(),
|
||||
tolower ) ;
|
||||
}
|
||||
|
||||
void Entry::Update( const xml::Node& n )
|
||||
{
|
||||
m_title = n["title"] ;
|
||||
|
@ -123,13 +82,6 @@ void Entry::Update( const xml::Node& n )
|
|||
tolower ) ;
|
||||
}
|
||||
|
||||
std::string Entry::Parent( const Json& entry )
|
||||
{
|
||||
Json node ;
|
||||
return entry["link"].FindInArray( "rel", "http://schemas.google.com/docs/2007#parent", node ) ?
|
||||
node["href"].Str() : std::string() ;
|
||||
}
|
||||
|
||||
const std::vector<std::string>& Entry::ParentHrefs() const
|
||||
{
|
||||
return m_parent_hrefs ;
|
||||
|
|
|
@ -46,7 +46,6 @@ class Entry
|
|||
{
|
||||
public :
|
||||
explicit Entry( const Path& file ) ;
|
||||
explicit Entry( const Json& entry ) ;
|
||||
explicit Entry( const xml::Node& n ) ;
|
||||
Entry( const std::string& title, const std::string& href ) ;
|
||||
|
||||
|
@ -71,9 +70,7 @@ public :
|
|||
void Swap( Entry& e ) ;
|
||||
|
||||
private :
|
||||
void Update( const Json& entry ) ;
|
||||
void Update( const xml::Node& entry ) ;
|
||||
static std::string Parent( const Json& entry ) ;
|
||||
|
||||
private :
|
||||
std::string m_title ;
|
||||
|
|
Loading…
Reference in New Issue