comparison liboctave/str-vec.cc @ 2493:8ed4362aa0d6

[project @ 1996-11-11 02:35:04 by jwe]
author jwe
date Mon, 11 Nov 1996 02:39:26 +0000
parents 1b57120c997b
children 8b262e771614
comparison
equal deleted inserted replaced
2492:06595bc7f2d0 2493:8ed4362aa0d6
28 28
29 #include <iostream.h> 29 #include <iostream.h>
30 30
31 #include "oct-term.h" 31 #include "oct-term.h"
32 #include "str-vec.h" 32 #include "str-vec.h"
33
34 // Create a string vector from a NULL terminated list of C strings.
35
36 string_vector::string_vector (const char * const *s)
37 : Array<string> ()
38 {
39 int n = 0;
40
41 while (*s++)
42 n++;
43
44 resize (n);
45
46 for (int i = 0; i < n; i++)
47 elem (i) = s[i];
48 }
49
50 // Create a string vector from up to N C strings. Assumes that N is
51 // nonnegative.
52
53 string_vector::string_vector (const char * const *s, int n)
54 : Array<string> (n)
55 {
56 for (int i = 0; i < n; i++)
57 elem (i) = s[i];
58 }
33 59
34 // Format a list in neat columns. Mostly stolen from GNU ls. 60 // Format a list in neat columns. Mostly stolen from GNU ls.
35 61
36 ostream& 62 ostream&
37 string_vector::list_in_columns (ostream& os) const 63 string_vector::list_in_columns (ostream& os) const