Exemplo n.º 1
0
 public virtual DcmElement PutPN(uint tag, String[] values)
 {
     if (values == null)
     {
         return StringElement.CreatePN(tag);
     }
     PersonName[] a = new PersonName[values.Length];
      for (int i = 0; i < a.Length; ++i)
     {
         a[i] = new PersonName(values[i]);
     }
     return Put(StringElement.CreatePN(tag, a, GetEncoding()));
 }
Exemplo n.º 2
0
 public virtual DcmElement PutPN(uint tag, PersonName[] values)
 {
     return Put(values != null?StringElement.CreatePN(tag, values, GetEncoding()):StringElement.CreatePN(tag));
 }
Exemplo n.º 3
0
 internal static DcmElement CreatePN(uint tag, PersonName value, Encoding encoding)
 {
     return new PN(tag, value.ToString(), encoding);
 }
Exemplo n.º 4
0
 internal static DcmElement CreatePN(uint tag, PersonName[] values, Encoding encoding)
 {
     String[] tmp = new String[values.Length];
      for (int i = 0; i < values.Length; ++i)
         tmp[i] = values[i].ToString();
     return new PN(tag, tmp, encoding);
 }
Exemplo n.º 5
0
        public PersonName(String s)
        {
            if (s == null)
                s = string.Empty;

            int grLen = s.IndexOf((System.Char) '=');
            if ((grLen == - 1?s.Length:grLen) > 64)
            {
                throw new System.ArgumentException(s);
            }

            Tokenizer stk = new Tokenizer(s, "=^");
            int field = FAMILY;
            String tk;
            while (stk.HasMoreTokens())
            {
                tk = stk.NextToken();
                switch (tk[0])
                {
                    case '^':
                        if (++field > SUFFIX)
                            throw new System.ArgumentException(s);
                        break;

                    case '=':
                        goto WHILE_brk;

                    default:
                        components[field] = tk;
                        break;

                }
            }
            WHILE_brk: ;

            if (!stk.HasMoreTokens())
                return ;

            tk = stk.NextToken("=");
            if (tk[0] != '=')
            {
                ideographic = new PersonName(tk);
                if (stk.HasMoreTokens())
                    tk = stk.NextToken("=");
            }
            if (!stk.HasMoreTokens())
                return ;

            tk = stk.NextToken();
            if (tk[0] == '=' || stk.HasMoreTokens())
                throw new System.ArgumentException(s);

            phonetic = new PersonName(tk);
        }