/[hyperestraier_wrappers]/trunk/perl/HyperEstraierWrapper.cpp
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/perl/HyperEstraierWrapper.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 9 by dpavlin, Thu Sep 8 16:42:55 2005 UTC revision 17 by dpavlin, Sat Sep 10 08:22:04 2005 UTC
# Line 455  namespace estraier { Line 455  namespace estraier {
455                  return vs;                  return vs;
456          }          }
457    
458          class NetEnv {          class ResultDocument {
         private:  
                 int ok;  
459          public:          public:
                 NetEnv() {  
                         ok = est_init_net_env();  
                         if (! ok) throw IOError("can't init net env");  
                 }  
                 ~NetEnv() {  
                         est_free_net_env();  
                 }  
         };  
   
         class NodeDocument {  
         private:  
460                  ESTRESDOC *rdoc;                  ESTRESDOC *rdoc;
461          public:                  ResultDocument(ESTRESDOC *_rdoc) {
462                  NodeDocument(ESTNODERES *nres, int index) {                          rdoc = _rdoc;
                         rdoc = est_noderes_get_doc(nres, index);  
463                  }                  }
464                  const char *uri(void) {                  const char *uri(void) {
465                          return est_resdoc_uri(rdoc);                          return est_resdoc_uri(rdoc);
# Line 499  namespace estraier { Line 485  namespace estraier {
485          private:          private:
486                  ESTNODERES *nres;                  ESTNODERES *nres;
487          public:          public:
488                  NodeRes(ESTNODE *node, ESTCOND *cond, int depth) {                  NodeRes(ESTNODE *node, Condition *cond, int depth) {
489                          nres = est_node_search(node, cond, depth);                          nres = est_node_search(node, cond->cond, depth);
490                  }                  }
491                  ~NodeRes() {                  ~NodeRes() {
492                          est_noderes_delete(nres);                          est_noderes_delete(nres);
# Line 518  namespace estraier { Line 504  namespace estraier {
504                  int doc_num(void) {                  int doc_num(void) {
505                          return est_noderes_doc_num(nres);                          return est_noderes_doc_num(nres);
506                  }                  }
507                  NodeDocument * get_doc(int index) {                  ResultDocument * get_doc(int index) {
508                          return new NodeDocument(nres, index);                          ESTRESDOC *rdoc = est_noderes_get_doc(nres, index);
509                            if (rdoc) {
510                                    return new ResultDocument(rdoc);
511                            } else {
512                                    return NULL;
513                            }
514                  }                  }
515          };          };
516    
517          class Node {          class Node {
518          private:          private:
519                  ESTNODE *node;                  ESTNODE *node;
520                    int netenv_ok;
521          public:          public:
522                  Node(const char *url) {                  Node(const char *url) {
523                            netenv_ok = est_init_net_env();
524                            if (! netenv_ok) throw IOError("can't init net env");
525                          node = est_node_new(url);                          node = est_node_new(url);
526                          if (! node) throw IOError("can't create node");                          if (! node) throw IOError("can't create node");
527                  }                  }
528                  ~Node() {                  ~Node() {
529                          est_node_delete(node);                          est_node_delete(node);
530                            est_free_net_env();
531                  }                  }
532                  void set_proxy(const char *host, int port) {                  void set_proxy(const char *host, int port) {
533                          est_node_set_proxy(node, host, port);                          est_node_set_proxy(node, host, port);
# Line 603  namespace estraier { Line 598  namespace estraier {
598                  double size(void) {                  double size(void) {
599                          return est_node_size(node);                          return est_node_size(node);
600                  }                  }
601                  NodeRes * search(ESTCOND *cond, int depth) {                  NodeRes * search(Condition *cond, int depth) {
602                          return new NodeRes(node, cond, depth);                          return new NodeRes(node, cond, depth);
603                  }                  }
604                  int set_user(const char *name, int mode) {                  int set_user(const char *name, int mode) {

Legend:
Removed from v.9  
changed lines
  Added in v.17

  ViewVC Help
Powered by ViewVC 1.1.26