FAQ
Author: marvin
Date: Fri Nov 20 06:05:20 2009
New Revision: 882426

URL: http://svn.apache.org/viewvc?rev=882426&view=rev
Log:
Commit LUCY-64, adding Lucy::Store::DirHandle -- a module for iterating over
the entries in a directory.

Added:
lucene/lucy/trunk/core/Lucy/Store/DirHandle.bp (with props)
lucene/lucy/trunk/core/Lucy/Store/DirHandle.c (with props)

Added: lucene/lucy/trunk/core/Lucy/Store/DirHandle.bp
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/core/Lucy/Store/DirHandle.bp?rev=882426&view=auto
==============================================================================
--- lucene/lucy/trunk/core/Lucy/Store/DirHandle.bp (added)
+++ lucene/lucy/trunk/core/Lucy/Store/DirHandle.bp Fri Nov 20 06:05:20 2009
@@ -0,0 +1,68 @@
+parcel Lucy;
+
+/** Iterate over the files in a directory.
+ */
+abstract class Lucy::Store::DirHandle cnick DH
+ extends Lucy::Object::Obj {
+
+ CharBuf *dir;
+ CharBuf *entry;
+
+ /** Abstract constructor.
+ *
+ * @param dir The path to the directory.
+ */
+ inert DirHandle*
+ init(DirHandle *self, const CharBuf *dir);
+
+ /** Proceed to the next entry in the directory.
+ *
+ * @return true on success, false when finished.
+ */
+ abstract bool_t
+ Next(DirHandle *self);
+
+ /** Attempt to close the DirHandle. Returns true on success, sets
+ * Err_error and returns false on failure.
+ */
+ abstract bool_t
+ Close(DirHandle *self);
+
+ /** Return the object's <code>dir</code> attribute.
+ */
+ CharBuf*
+ Get_Dir(DirHandle *self);
+
+ /** Return the path of the current entry. The value is updated by each
+ * call to Next(), and is only valid when Next() has returned
+ * successfully.
+ */
+ CharBuf*
+ Get_Entry(DirHandle *self);
+
+ /** Returns true if the current entry is a directory, false otherwise.
+ */
+ abstract bool_t
+ Entry_Is_Dir(DirHandle *self);
+
+ /** Invokes Close(), but ignores any errors.
+ */
+ public void
+ Destroy(DirHandle *self);
+}
+
+/* Copyright 2009 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+

Propchange: lucene/lucy/trunk/core/Lucy/Store/DirHandle.bp
------------------------------------------------------------------------------
svn:eol-style = native

Added: lucene/lucy/trunk/core/Lucy/Store/DirHandle.c
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/core/Lucy/Store/DirHandle.c?rev=882426&view=auto
==============================================================================
--- lucene/lucy/trunk/core/Lucy/Store/DirHandle.c (added)
+++ lucene/lucy/trunk/core/Lucy/Store/DirHandle.c Fri Nov 20 06:05:20 2009
@@ -0,0 +1,43 @@
+#define C_LUCY_DIRHANDLE
+#include <stdarg.h>
+#include "Lucy/Util/ToolSet.h"
+#include "Lucy/Store/DirHandle.h"
+
+DirHandle*
+DH_init(DirHandle *self, const CharBuf *dir)
+{
+ self->dir = CB_Clone(dir);
+ self->entry = CB_new(32);
+ ABSTRACT_CLASS_CHECK(self, DIRHANDLE);
+ return self;
+}
+
+void
+DH_destroy(DirHandle *self)
+{
+ DH_Close(self);
+ DECREF(self->dir);
+ DECREF(self->entry);
+ SUPER_DESTROY(self, DIRHANDLE);
+}
+
+CharBuf*
+DH_get_dir(DirHandle *self) { return self->dir; }
+CharBuf*
+DH_get_entry(DirHandle *self) { return self->entry; }
+
+/* Copyright 2009 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+

Propchange: lucene/lucy/trunk/core/Lucy/Store/DirHandle.c
------------------------------------------------------------------------------
svn:eol-style = native

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouplucy-commits @
categorieslucene
postedNov 20, '09 at 6:05a
activeNov 20, '09 at 6:05a
posts1
users1
websitelucene.apache.org

1 user in discussion

Marvin: 1 post

People

Translate

site design / logo © 2018 Grokbase