home *** CD-ROM | disk | FTP | other *** search
- /*
- * Copyright (C) 1994, Silicon Graphics, Inc.
- * All Rights Reserved.
- *
- * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
- * the contents of this file may not be disclosed to third parties, copied or
- * duplicated in any form, in whole or in part, without the prior written
- * permission of Silicon Graphics, Inc.
- *
- * RESTRICTED RIGHTS LEGEND:
- * Use, duplication or disclosure by the Government is subject to restrictions
- * as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
- * and Computer Software clause at DFARS 252.227-7013, and/or in similar or
- * successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
- * rights reserved under the Copyright Laws of the United States.
- */
- #pragma once
-
- #include "OkStr.h"
-
- // Abstract class for searches
-
- class OkTextPat {
- private:
- public:
- OkTextPat();
- virtual ~OkTextPat();
-
- // find the string in a buffer of length buflen. Null characters
- // may be considered to be the end of the buffer. If the string
- // is not found, a -1 is returned.
- int find(char* b, u_int bl)
- { return findBuffer(b, bl); }
- int find(char* c)
- { return findBuffer(c, strlen(c)); }
- int find(OkStr& s)
- { return findBuffer(s, s.length()); }
-
- // find the end of the string, after the next occurrence.
- // If the string is not found, 0 is returned.
- int findEnd(char* b, u_int bl)
- { return findEndBuffer(b, bl); }
- int findEnd(char* c)
- { return findEndBuffer(c, strlen(c)); }
- int findEnd(OkStr & s)
- { return findEndBuffer(s, s.length()); }
-
- // find the beginning and end of the first occurrence of the string
- // in a null-terminated buffer. If the string is
- // not found, start=-1 and end=0.
- void bracket(char* b, u_int bl, int& start, int& end)
- { bracketBuffer(b, bl, start, end); }
- void bracket(char* c, int& start, int& end)
- { bracketBuffer(c, strlen(c), start, end); }
- void bracket(OkStr& s, int& start, int& end)
- { bracketBuffer(s, s.length(), start, end); }
-
- protected:
- virtual int findBuffer(char*, u_int) = 0;
- virtual int findEndBuffer(char*, u_int) = 0;
- virtual void bracketBuffer(char*, u_int, int&, int&) = 0;
- };
-
-